Show a different price to multiple WooCommerce customers


In a previous snippet we looked at how to set up customer specific pricing for a single customer in WooCommerce. But what if you wanted to show a different price for multiple customers? Well, it’s just as easy and in this snippet we will show you how to do just that.

We’re going to use a similar code base as the previous example but modify it for multiple customers.

Step 1: Find the customer ID’s for the different prices

We firstly need to get a list of customers who we would like to show a special price to. We can use the WordPress admin interface for this. Click on Users on the admin sidebar and search the list of users for the ones that you would like to show a custom price to. On each user that you select, click them and fetch the user ID from the URL parameter as per the previous example. Below is a screenshot that will help you identify where to find the user ID once you’ve clicked on the user from the user list.

Different Price For Multiple Users - User ID From URL

Step 2: Use the woocommerce_product_get_price to show a different price for the customer group

Below is the code snippet that you should modify. The most important piece is the PHP array which contains a list of user ID’s. Replace the list in the snippet with your list of users that you’ll be giving a different price to.

* Set a different price for multiple different WooCommerce customers.
* @param float $price The current price of the item.
* @return float
function thenga_customer_specific_pricing( $price ) {
// Add your list of user ID's here.
$special_customer_ids = [ 1, 2, 3 ];

if ( in_array( get_current_user_id(), $special_customer_ids, true ) ) {
// Give these customers a 20% discount.
return $price * 0.8;

return $price;

add_filter( 'woocommerce_product_get_price', 'thenga_customer_specific_pricing', 10, 1 );

Step 3: Add the customized snippet to your functions.php and save

Once you’ve updated the customer ID list, save the snippet to your functions.php file and upload it to your server.

This snippet can be extended to only change the price of a specific product or multiple products by changing the amount of arguments that get passed via woocommerce_product_get_price to 2. This then passes through the product object which you can use to adjust your conditional logic.

If you prefer not to have to write the code yourself, then check out some of our WooCommerce pricing products.


  1. Can this code be modified, so instead of showing different price to a group of customers, to show different price to all customers coming from a specific source/website using either the data from the UTM parameters or something similar?

    1. Absolutely! You’ll need to use the `$_GET` global variable and implement a switch statement to change the price based on the value of the variable you choose.


  2. Hello!
    I’ve added this snippet and it works great, thank you.
    What I need is to show both regular and sale price on front end, something like:

    Regular price: 100, 00
    Sale price: 70,00

    Can you help me with it?

    1. Hi Ena,

      This is slightly more complex that the snippet allows for. To be able to do this, you’ll need to modify your theme to get the original price and display it where you would like. Have you maybe checked if there is a plugin that can do this? I’d recommend using a plugin if possible.


  3. Hello, great tutorial, im non techie and able to give specific price to specific group of user following you articles.

    i would like to know how to combining specific user id and specific product id so i can display specific price.

    for example :
    user id 2 and product id 1 price * 10 %
    user id 2 and product id 2 price * 15 %

    * i have 2 group of product id which is the price times by 10% and 15%

    1. Hi Morgan,

      Yes, you can have the woocommerce_product_get_price filter pass in a second argument which is the $product object and based on that product object and the user ID, you can adjust the price. Hope that makes sense?


Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.