Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

WP-client multiple pricing

Does anyone know if its possible to show different prices for the same product when different users are logged in?

If yes, then how is this possible?

Yhank you very much in advance!

1 Answer

Sure it's possible, but you'd probably have to work with variables and if-then statements inside your php-file for the particular page. Also you should carefully consider if the price depends on a specific user or on a user-class (role). Let's say it depends on specific user, then you could use user-ID as a means to filter the prices shown. So something like this:

<?php
  $user_id = get_current_user_id();

  if ($user_id = "James") {
    $price = x;

  } else {
    $price = y;
}
?>

I'm not sure the entire code is correct, but it should be something like that.