Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.