Pricing of the products is one of the most crucial features for the seller. However, sometimes because of certain promo codes the price of the products are discounted for a specific chunk of users. In such circumstances Role Based Pricing Plugin plays a very prominent role as it enables those specific customers to see the discounted price while not affecting the regular price for other customers. Through the Plugin you can set the price of your product based on the role of the user and individual customers. Hence, being a merchant the plugin makes your life easier. In this article we will guide you about various ways through which you can add the plugin to your store.
Add Role Based Pricing in WooCommerce – 2 Methods
There are two methods by which you can add Role Based Pricing for WooCommerce to your store.
- Add Role Based Pricing for WooCommerce by Addify.
- Add Role Based Pricing for Woocommerce Programatically.
Method#1: Role Based Pricing for Woocommerce by Addify
The Role Based Pricing for Woocommerce is a plugin that empowers you to define the price of your products according to the specified user roles and even the individual customers. The Plugin will help in providing the discounted or markup prices and apply a fixed or percentage amount to them. The new prices can only be viewed by the customers you allow.
The extension comes with various features such as rule-based management in which you can change prices in bulk for selected products or the whole category. You can also select to set a minimum or maximum order quantity and restrict the customers to purchase beyond the predefined limit. The Plugin also allows you to hide the add to cart button or the price of products for the customers who are not logged in. Hence, the plugin can help you to great extent in managing various things.
Installation
Please follow the steps mentioned below to download the plugin:
- Download the .zip file from WooCommerce account,
- Visit the WordPress Admin > Plugins> Add New and upload the plugin file that has been downloaded.
- Install the Plugin and Activate it.
Setup and Configuration
Once you have activated the plugin, you can see the “ Price by User Role” in the menu of WordPress admin menu and approach the product level settings from the page of product edit.
Set Role Based Prices for Individual Products
Visit the edit page of the product and click on the “ Price by User Role” to access the settings. The setting will allow you to:
- Pick the user role and customer for which you want to alter the prices.
- Adjust the fixed price or increase or decrease price by a certain percentage or even a fixed amount.
- Minimum and maximum order quantity can also be modified.

Set Role Based Prices for Specific Variation of a Product
In order to update the price for any kind of variation you have to visit the product edit page and amend the variations. While visiting the variation setting you can also see the “ Price by User Roles” section. From this section you can alter and update the price for each variation. Also note that currently there is no option from which you can update the price in bulks for variations or attributions.

Set up Role Based Pricing in Bulk
In order to update the prices of certain user roles or for customers in bulk, visit the “ Price by User Role” from the left admin menu and steer to the “Add New Rule”. By adding the new rule you can:
- Mention the user role of customers for whom you want to alter or update the prices.
- Choose products or categories for which you want to change the prices.
- Adjust the fixed price or increase/ decrease price by a percentage or through a fixed amount.
- Minimum or maximum number of order quantities can also be adjusted.

Same discount will be activated for all variants of a variable product.
Customise Messages for Minimum and Maximum Quantity
You can customise the error message for minimum and maximum order quantity.
Conceal the Price and Add to Cart Button
From the admin menu visit the Role-Based Pricing and then go to “Hide Price Setting” option. From this option you can configure the following functions.
- The price of products or add to cart options for products can be hidden.
- You can also hide only the add to cart option.
- Hide the option for users who are not logged in.
- For the registered users you can also hide the options under specific user roles.
- Substitute the price with custom text.
- The Add to cart option can be replaced with a new and customizable button.
- Personalise the Button Text and Link.
- Specific categories and products can be hidden.
- If you want to hide all the catalogue, Choose All categories option.

Understand the Priorities
The Role Based Pricing for WooCommerce has certain priorities to handle the overlapping of price adjustments. Below we have mentioned how the default priorities work.
- Product Level Settings
- Setting Price for specific Customers.
- Setting price for specific user role.
- Rule-Based Settings
- Setting price for specific customers.
- Setting price for specific user role.
Method#2: Add Role Based Pricing for Woocommerce Programatically
In a nutshell,the approach has 3 easy steps.
- First create a new user role
- Create new fields in products to store multiple prices information
- Create hooks to apply on products
Now, copy and paste the following code into functions.php file of your active or child theme.
<?php
// Create hooks for all kind of products
add_filter('woocommerce_product_get_price', 'ui_custom_price_role', 99, 2 );
add_filter('woocommerce_product_get_regular_price', 'ui_custom_price_role', 99, 2 );
add_filter('woocommerce_product_variation_get_regular_price', 'ui_custom_price_role', 99, 2 );
add_filter('woocommerce_product_variation_get_price', 'ui_custom_price_role', 99, 2 );
function ui_custom_price_role( $price, $product ) {
$price = ui_custom_price_handling( $price, $product );
return $price;
}
// Variable (price range)
add_filter('woocommerce_variation_prices_price', 'ui_custom_variable_price', 99, 3 );
add_filter('woocommerce_variation_prices_regular_price', 'ui_custom_variable_price', 99, 3 );
function ui_custom_variable_price( $price, $variation, $product ) {
$price = ui_custom_price_handling( $price, $product );
return $price;
}
//roll based operations are done here
function ui_custom_price_handling($price, $product) {
// Delete product cached price, remove comment if needed
//wc_delete_product_transients($variation->get_id())
;
//get our current user
$current_user = wp_get_current_user();
//Select the user role for which price will be added
if ( isset( $current_user->roles[0] ) && '' != $current_user->roles[0] && in_array( 'wholesale_user', $current_user->roles ) ) {
//Add custom prices for products
$custom_price = get_post_meta( $product->get_id(), 'wholesale_price', true );
//If you have a custom price, apply it
if ( ! empty($custom_price) ) {
$price = $custom_price;
}
}
return $price;
}
?>
To Conclude
We hope that this article has answered most of your queries regarding the installation process; however, if you have any further questions please contact our support team without any hesitation to get the answers.