The WooCommerce User Role Pricing extension allows you to create any number of custom price fields for WooCommerce products, and then select which price to use as a base price, along with a price multiplier, for each role or individual user. Individual user settings take priority over user role settings. If there are no settings for a specific user, that user gets the settings for their role. The plugin also allows you to create as many custom roles as you need.In addition to custom prices and price multipliers, you can also specify if the role/user is tax exempt, if shipping is disabled, if they should have a billing account, and if they should be treated as a wholesale customer (when used along with Woocommerce Wholesale Ordering). Version 4 also allows you to have WooCommerce coupons that can only be used by specific roles.
For each custom price that you create, you can specify if the prices entered are entered including or excluding taxes.
Nothing should change after you install the plugin until you modify some settings. The plugin settings are on their own “User Role Pricing” sub-menu page, under WooCommerce in your dashboard menu. Just like the WooCommerce settings, the User Role Pricing settings are split across several tabs, some of which have their own sub-sections.
You can modify prices for individual users, or for roles, in several ways:
- In the main Role Settings section on the Role Settings tab, you will see a table of the roles for your WordPress site, with several settings for each role. Here you can set the Base Price and Price Multiplier for each role, as well as enabling some other features via check boxes. Please note that you can NOT change options for regular customers or guests, as those will follow the main WooCommerce settings. In addition, if you have Woocommerce Wholesale Ordering installed and active, as of version 2.1.6 you can now change base price and multiplier for the Wholesale Customer role on this page. Also with Woocommerce Wholesale Ordering installed, you will see an additional check box for other roles that allow you to treat those roles as wholesale customers. Leave everything at the “Default” settings, and the check boxes unchecked, to use the regular WooCommerce settings for those roles.
- Similar fields to those on the Role Settings page are also added to the admin edit user page, allowing you to specify the settings you want for a specific user. If you change any of the user’s settings to anything other than the default settings, those settings will override the settings for that user’s role. It’s on a per setting basis, so any settings you leave to default will use the role setting.
- If you need a custom price for a role or user, you can create your own custom price field on the Prices tab in the User Role Pricing page. Create a name for your price, and select if those prices will be entered including or excluding taxes. Be aware that how those prices are displayed in the shop & cart/checkout pages will be determined by the WooCommerce tax settings for non-wholesale customers, and by the WooCommerce Wholesale Ordering settings if you have that plugin installed and have that role/user set to be treated as wholesale. Be careful with the settings here, particular if using the “revert” option for when no prices have been entered for a custom price, as it might not function as you expect if the custom price was entered one way (including/excluding tax) and the price that it reverts to was set to be entered the opposite way. For retail customers & guests, the “revert” price will be the WooCommerce regular price. For users/roles treated as wholesale, the “revert” price will be the wholesale price.
- No matter if you use the role settings, or individual user settings, the price for that role/user is determined by the Base Price you set multiplied by the Price Multiplier. If you have a role or user that you simply want to give a fixed discount to, there is no need to create a custom price field. Just select the regular price (or wholesale price) as the base price, and then set the multiplier to set the discount amount (such as 0.8 for a 20% discount). It’s always best not to create more custom price fields that you really need!
- With version 2.1.6, you can now specify a different base price and multiplier for the Wholesale Customer role that Woocommerce Wholesale Ordering creates. So, now if your wholesale customers always get a fixed discount off of the regular price, you can simply set that role to use the Regular Price as the base price, and enter the multiplier value desired to give them their discount, and then there is no longer any need to have to manually enter a wholesale price for every product.
- If you need to set up a custom role for a group of customers that need custom pricing, you do that on the “Add A Role” section of the Role Settings tab. When creating a new role, first select a role that you want to copy. The new role you create will have all the same capabilities for your site as the role you choose to copy. The “Customer” role that WooCommerce creates is usually a good role to copy, as that gives the users the minimum capabilities needed to shop on your site and manage their billing/shipping/account info.
- Action when no price – Specifies what happens if there is no price (blank) for a custom price field for a product. Possible options are:
- Revert – will fall back to the WooCommerce Regular Price (or Sale Price). If you are using the WooCommerce Wholesale Ordering plugin, and the user/role is set to be treated as wholesale, then the revert price will be the wholesale price for the product. Please note that when using Revert, the price multiplier will NOT be applied to the reverted price. Also, note that for customers treated as wholesale who have the wholesale price set as their base price, their prices will NOT revert to regular prices if there is not a wholesale price entered for that product (the wholesale price IS the revert price for customers treated as wholesale, and no wholesale price is how you create “retail only” products).
- Hide – Simply hides the product from the shop pages, and makes it non-purchasable (if they find the product page anyway)
- Message – Shows a simple text message in place of the price (default is “Not Available”) and makes the product non-purchasable. You can define the text message with the No Price Text option (below)
- Restrict Content – If you are choosing to Hide products without a price for the current customer (above option), then you can check this box to also restrict the content on the single product page (in case the customer happens to find a link to the individual product page). When this is checked, the normal single product page content will be replaced by the text/HTML you enter in the textarea below.
- Restricted Page Content – Enter your text/HTML here to show on restricted product pages for a customer when the above Restrict Content option is checked.
- No Price Text – Enter the text you want to show instead of the price when using the “Message” option in the above setting.
- Billing Account Label – The name of the billing account field you want users to see on the checkout page and in their profile, at the bottom of the billing address section. This field will show up if you enable Billing Account for a role or user. This label is global (can’t currently be set differently for different users or roles). The billing account will be saved in the user meta table, along with their normal billing info, so once they fill in the account info, it will be pre-loaded at checkout for any future orders (but can always be edited by the user).
- Delete ALL data on uninstall – Check this box if you want to completely wipe out ALL data created by this plugin when you uninstall it (only on Uninstall/Delete, does NOT delete anything when you deactivate the plugin). All plugin options will be deleted, and all custom prices for all products will be deleted. The only thing that is not deleted are any custom roles you created since any users with those roles would no longer be able to access your site. However, before you uninstall/delete the plugin, you can delete any custom roles you create from the Role Settings tab, in the “Remove A Role” section.
- Use Sale Prices – If you check this box, any users or roles that have the base price set to “Default” or “Regular Price” will use the regular WooCommerce sale price logic, which uses the sale price instead of regular price is it is present and less than the regular price. Note that if your user or role has a price multiplier set other than 1, that multiplier will get applied to the sale price as well! The only time the Sale Price is NOT used is if the user or role has a different base price, but you have the “Revert” option selected for when there is no base price for a product — in that case it ONLY uses the Regular Price even when a Sale Price exists. Note also that Sale Prices do not apply to users or roles treated as wholesale customers (when used with Wholesale Ordering), since there is no Wholesale Sale Price field.
- Allow “Member” Sales – This option was added in version 1.4, and allows sale prices to override “member” prices when the sale price is less than the calculated member price. A “member” is defined as any role/user that does NOT use default WooCommerce pricing. Meaning that either their base price is a custom price field you created or their price multiplier is anything other than 1 (or a combination of both). When this option is enabled, the member price will be calculated as normal using the user/role base price and price multiplier, but if the sale price (regular WooCommerce sale price field) is less than that calculated price, then the sale price will be used and that product will be considered “On Sale” (showing any sale banners your theme uses).
- Use Multiplier on Sale Prices – This option was added in version 1.4, and allows you to specify if the user/role price multiplier should be applied to sale prices. This option works if either of the above 2 options are enabled.
- Use Multiplier on Reverted Wholesale Prices – This option was added in version 1.4, and allows you to specify if the user/role price multiplier should be applied to reverted Wholesale Prices. This only applies if you are using this plugin in conjunction with the Wholesale Ordering plugin, AND you have “revert” set as the option for when there is no base price for a user role, AND the user/role is set to be treated as Wholesale, AND the base price for that user/role is something other than the Wholesale Price (from Wholesale Ordering), AND there is no base price set for the product (thus reverting to the Wholesale Price).
- Force Update Mini Cart – Force a mini-cart re-calculation when adding products via AJAX (product added without the page reloading) from a shop or category page. Off by default, but may be needed to display the correct price immediately after the first AJAX update for plugins like VarkTech Pricing Deals. If it is off, those types of plugins may cause the mini-cart to show the wrong price until you refresh the page or visit the cart.
- Enable Price Caching – Checking this will create a transient/cache of min/max custom base prices, for each custom price, from the custom prices meta table, which will greatly speed up page load times on shop/category pages that display a lot of products. Only the transient cache for the current customer’s custom price will be loaded.
Role Settings – Main Section
- Base Price – Select the price you want to use as the Base Price for each role in the table. Leave this set to default to use the WooCommerce Regular Price (or Sale Price). If WooCommerce Wholesale Ordering is installed and active, and you have a role set to be treated as wholesale, leaving this set to default will use the Wholesale Price instead of Regular Price.
- Multiplier – Enter the Price Multiplier for the role. If you leave it blank, a default multiplier of 1 will be used. Prices are determined for each role by the Base Price multiplied by the Price Multiplier.
- Tax Exempt – The options are “Yes” or “No” or “Default”. Default will use the regular WooCommerce settings, unless you are also using the Wholesale Ordering plugin and have the role set to be treated as admin, in which case “Default” will use the Wholesale Ordering settings. “Yes” makes the role tax exempt, while “No” explicitly makes the role taxable. Role settings can be overridden by individual user settings. If taxes are globally disabled in WooCommerce, then these settings do not matter. NOTE: When using Wholesale Ordering with additional roles set to be treated as wholesale in User Role Pricing, if you want some roles to be tax exempt, taxes must first be enabled in the Wholesale Ordering settings (meaning that the default Wholesale Customer role that Wholesale Ordering creates will not be tax except). Then, you can create additional roles and set them to be treated as wholesale, and use this Tax Exempt setting to override the Wholesale Ordering setting, by setting it to “NO” for the new wholesale roles that you want to be tax exempt.
- Disable Shipping – Settings and operation are the same as for Tax Exempt, except that this setting determines if shipping should be calculated for the role. Shipping calculations need to be enabled in WooCommerce for this to have any effect.
- Billing Account – Check this to enable the billing account field for users with this role. This creates an extra billing field at checkout and in the billing address area of the My Account page, using the label that you entered in the General Setting page. Information entered into this field is saved in the user’s meta fields (like the other billing fields), and so it will be automatically filled in for future orders.
- Treat As Wholesale – This checkbox field only shows up if you have Woocommerce Wholesale Ordering installed. Checking this field will cause users of that role to be treated as Wholesale Customers. This means that they will use the independent tax settings of the Wholesale Ordering plugin, custom price prefix and suffix, wholesale messages, and most of the other settings that apply to regular Wholesale Customers (as defined by the Wholesale Ordering plugin). This is done by a modifying a filter in the Wholesale Ordering plugin to tell that plugin if the current user is wholesale or retail. This allows you to have multiple levels of “Wholesale” customers, with their own base prices and multipliers, but still using all the other settings of the Wholesale Ordering plugin.
User Pricing and Tax Options on User Edit page
All of the above Role Settings are duplicated in special fields in this section of the Edit User page in the Users section of your admin dashboard. If you set any of the user fields to anything other than the default setting, they will override the role setting for that user’s role. This is mostly useful if you have a customer who orders a lot more than anyone else, and you want to give them an extra fixed discount off of your prices to other users of the same type. In that case, all you would need to do is change the multiplier for that particular user on their edit user page. The settings have the same functions as described in the Role Settings above, except that any check box options have been replaced with select boxes, so you can choose “yes”, “no”, or “Default”. “Default” keeps the role setting. For the multiplier, set it to 0 (zero) to keep the role setting. Note that each one of these options is treated individually, so you only need to change the specific options you want to override for that specific user, and leave all the other options set to the default setting to use the role settings.
Modified Settings for Admin users when using WooCommerce Wholesale Ordering
Since there is a setting in WooCommerce Wholesale Ordering to determine if the admin should be treated as wholesale or retail (useful for testing), the checkbox for Treat As Wholesale on the Role Settings page is disabled for the admin user, and it’s state (checked or unchecked) will reflect the current setting of the option in the Wholesale Ordering plugin. However, you can still override it on an individual user basis from the edit user page for any admin user (select Your Profile to edit your own admin user settings). On that page, for admin users, the select box for “Treat As Wholesale Customer” will have a slightly different description, and the “Default” setting is changed to “Wholesale Plugin Setting”.
Role Settings – Add A Role
This section allows you to add a custom role to your site for use with custom customer types. First you must select a role to copy. The new role you create will inherit the same capabilities as the role you copy. Most often you will want to copy the “Customer” role that WooCommerce creates, which itself is essentially a copy of the “Subscriber” role. Then, simply enter a name for the new role. The name is what will appear in the role select box when you add or edit a user, and will never be seen by any user on the public side of your site. Make sure you give it a unique name that is not already in use by another role.
Role Settings – Remove A Role
Be careful with this!! There is a warning on this page to let you know that removing a role will cause any users assigned that role to lose all privileges for your site! You must select the role you want to remove, and then check the confirmation box, before you can click the button to delete the role. Please note that you are not allowed to delete the admin, Customer, or Wholesale Customer roles, but all other editable roles are fair game for deleting.
This page has a simple table showing the currently defined prices (not including the Sale Price). You can check the boxes next to any of your custom prices if you want to delete that price from the system. Click the “Delete Selected Prices” button to delete any prices you selected. Please note that you can’t delete Regular Price or Wholesale Price.
Meta keys for the prices are also shown in the table, which can be helpful if you are using importer/exporter plugins to import/export products.
Add a new Price field – Use this section of the page to add a custom price. Once you create a custom price, there will be inputs for that price for every product and variation. To save system resources, try not to use more price fields than you really need. If certain customers always get a fixed percentage above or below an existing price, just set up a different price multiplier for that role/user rather than creating a new price.
Prices Include Tax? – Be sure to set this correctly when you create the price, as you can’t change it later (maybe in a future update). Also, consider your settings for what to do when there is no price entered for a custom price. If you use the “revert” option, but the price you revert to has the opposite setting for prices include tax, your product prices and tax calculations will be wrong. If you are using this plugin by itself, prices will “revert” to the WooCommerce Regular Price (or Sale Price). If you are using this plugin with the Wholesale Ordering plugin, then the prices will “revert” to the Wholesale Price for roles/users treated as wholesale, and the Regular Price (or Sale Price) for all other roles/users.
Free versus No Price logic
Starting with version 1.1.3, this plugin uses the same logic as the Wholesale Ordering plugin to determine if a product is “free” or if it has “no price”. You must enter a price of zero (the number 0) for a product to be free for any users/roles using that price as a base price. If you leave the price field blank, then that product is considered to have no price and what happens is determined by your “Action when no price” setting. Also note that when used in conjunction with the Wholesale Ordering plugin, any users/roles treated as wholesale will follow the wholesale ordering plugin setting of “Allow FREE Products” (please read the WooCommerce Wholesale Ordering docs for more details on those settings).
This settings page was added in version 1.4 and allows you to create very highly customized pricing displays, with independent settings based on the type of customer. The 3 types of customers are defined as “Member”, “Non-Member”, and “Guest”, and there are separate sections to set the price display for each. In addition, if you are using this plugin in conjunction with the Wholesale Ordering plugin, you can decide if you want to use the Wholesale Ordering plugin’s custom price display settings for Wholesale Customers, or if you want to use the custom “Member” price display you set up here.
Members are defined as logged in users that do NOT have default pricing. They must have a custom base price and/or a price multiplier other than 1 to be considered a Member.
Non-members are logged in users that are set to use the default WooCommerce pricing. Their base price is set to Default or Regular, their multiplier is 1, and they are NOT treated as Wholesale (when using with the Wholesale Ordering plugin).
Guests are visitors that are NOT logged in.
For Members, there can be up to 3 prices shown. The Regular Price (which you can enable/disable via check box), the calculated Member price (base price times multiplier), and the Member Sale price (only when the Member Sales option is enabled, and the sale price is less than the calculated Member price). You can optionally hide the “Member” price when the product is determined to be on sale (based on the Member Sales calculations).
For Non-Members and Guests, only Regular Prices and Sale Prices (when entered) will be shown as these users do not have a custom price.
For each price that will be displayed for any type of customer, you can specify a prefix and/or suffix to be shown on the same line before and/or after the price. The prefix and suffix values can NOT contain any html. Only simple text. If you want to apply styles to any of the prices, each is wrapped in its own span with classes for the type of price and the customer type, making it very easy to target each type of price for separate styling, and even have different styles based on the customer type.
In addition, there is an HTML wrapper that you can create for each set of prices. Leave this blank if you don’t need it. Otherwise, you can use HTML for custom styling or to add additional lines of text/html above or below the custom price display. In order to display the prices, you need to use the %s placeholder (percent sign followed by lower case letter s) where you want the prices to be displayed (replaced using the PHP sprintf function).
Display Settings Options – there are several options at the top of the Display Settings page that should be fairly self-explanatory, but are listed here for reference:
- Enable Custom Price Display – Check this to override the normal WooCommerce html price display in the shop and product pages, and replace it with custom price display settings, as described above.
- Show Custom Prices for Non-Members? – Check this to show the non-member custom price display to logged in non-members. Leave un-checked to show the normal WooCommerce html price display.
- Show Custom Prices for Guest? – Check this to show the guest custom price display to non-logged in guest/visitors. Leave un-checked to show the normal WooCommerce html price display.
- Show Custom Prices for Wholesale Customers? – Check this to also show the custom price display to any logged in users set to be treated as wholesale. Checking this will override the wholesale prefix and suffix text settings in the Wholesale Ordering plugin, and prices will be displayed the same as any other logged in user.
- Sale Price Position – Where to show sale prices when a product is on sale. Below (default) the other prices, or above.
Product Update Utilities
This was formerly the “Sync” page, but the name has been changed as several new functions have been added. This page doesn’t have any settings. Instead there are several functions that allow you to update data for your products. By default, these functions process 10 products at a time via an AJAX loop, to help prevent time outs if you have a lot of products. But, you can change the number of products per batch with the “Sync Batch Size” setting in the General settings section. Below are descriptions of what each function does:
- Sync Variable Products – The Sync function serves a couple of purposes, and saves several entries in the variable products post meta table, as well as the new custom prices product meta table.
- It saves a custom price meta value for each of your custom created prices for the parent variable product, in the same way that WooCommerce does (one value if all variations have the same price, or two values if there is a separate min and max across all variations), so that direct product queries can use a simple meta query to determine if the product has a price or not. In User Role Pricing, this is used to determine if the variable product should be shown in the shop if you have it set to hide products without prices from roles or users that have that price set as their base price.
- It saves separate min variation price and max variation price meta fields each of your custom created prices for the parent variable product. This is used to speed up page load times when you have a lot of variable products on a shop page (especially if they each have a lot of variations). If the saved values exists, those values are used to create the HTML price range display for the variable product. If the saved value does not exist, then the plugin needs to get all the child products, loop through each of them, and calculate the min and max custom price values every time the page loads.
- In version 3.0, Min and Max values for custom prices for Variable products are also stored in the new custom prices product meta table, which is used for the Price Filter widget, and will also be used to save and preload the transient that stores all base prices, if you have that option enabled.
- In addition, if you are using this plugin in conjunction with WooCommerce Wholesale Ordering, you will also see a checkbox that allows you to include wholesale prices when synchronizing your variable products. This just saves you from having to run the sync function again from the Wholesale Ordering plugin. However, if you are running the function to initialize new custom price fields, then there is no need to check the box to include wholesale prices.
- Any time you update a variable product, that product will automatically be synchronized again. So, you should not need to synchronize products manually again. But, if you are using something like WP All Import to add or update products, including wholesale prices, bypassing the normal product update action hooks, then you will need to manually synchronize your variable products again. Also, it’s a good idea to run this function again any time you create a new custom price, so that the custom price meta fields get initialized for all your parent variable products.
- Update the URP Product Meta Table – This function was added in version 3.0, and needs to be run manually one time after you initially update, in order to populate the database table. This will save the min and max values for each custom price for each product that doesn’t have a parent (i.e., simple products, and variable products, but not the individual variations). This table is needed for proper operation of the Price Filter Widget, and is also used to create transients of the base price for each custom price, which can help with page load times if you have price caching enabled. The table should be automatically updated any time you update a product via the WC Product Editor, but you may need to manually run this function if you are using an importer to update custom prices, or some other type of bulk product editor plugin.
- Set Custom Prices – This new function allows you to quickly set your custom prices for ALL products, or for only products in a specific category. It will set the prices for simple products as well as each variation on every variable product. There are 5 inputs you use to control this function:
- Category – Select All Categories (ALL Products), or select a specific category if you only want to set prices for products in a specific category.
- Base Price – Select which price to use as the base price that you will calculate the custom (target) price from.
- Multiplier – This value will be applied to the Base Price you selected to calculate the target custom price for each product. Use fractional values, such as 0.5 to set the target price to 50% of the selected base price, or 1.25 to set the target price to 125% of the base price (25% above the base price).
- Target Price – Select the custom price that you want to set for each product based on the calculated price from the multiplier and base price
- Overwrite existing custom prices? – If you check this box, any existing target custom prices will be overwritten by the new calculated price. Leave this uncheck to only set prices for products where that target price does not exist yet.
- Adjust Custom Prices – This function allows you to adjust existing custom prices, either by a fixed amount or a percentage of the current price. The inputs are fairly self-explanatory:
- Price to Adjust – Select the custom price you wish to adjust
- Adjustment Category – Select a specific category to only adjust custom prices for products that belong to that category, or leave it set to “All Categories” to adjust prices for ALL products.
- Adjustment Direction – Select if you wish to increase or decrease the custom prices.
- Adjustment Type – Choose if you want to adjust by a fixed currency amount, or if you want to adjust by a percentage of the current custom price.
- Adjustment Amount – Enter a positive number value for the adjustment. For fixed adjustment type, enter a currency amount. For percentage adjustment type, the percentage should be entered as whole numbers, such as 10 for 10%.
- Delete Base Price Transients – This function simply deletes any existing base price transients for custom prices, if you have the price caching feature enabled. You should only need to use this function if you update your products via an importer or other method that doesn’t trigger the update product actions of WooCommerce.
- Delete Customer Price Transients – This will delete any price transients stored for specific customers. This transients are created and updated each time a customer views any products, to speed up subsequent page loads (so we don’t have to retrieve base price and multiplier and calculate all over again for each customer). Normally, all these transients will be deleted any time you update any product, but you may need to run this function if you are importing products or using some other type of bulk product editor that doesn’t trigger the update product actions of WooCommerce.
Coupon Codes – Allowed Roles
Here is where you enter and save/activate or deactivate your license for the plugin. Please note that I do NOT cripple my plugins in any way, and they are fully functional even if you never activate your license. Activating the license will allow you to get notices in your dashboard when updates are available, as well as being able to automatically update the plugin on the Updates page, just like any other plugin. Also, having a valid license gives you access to my personal support, as well as helping to cover the development costs of new features.
Also note that the licensing system I use allows you to set up a localhost install and activate the license there for testing, without it counting against the number of allowed licenses & site activations. So, you can safely set up a staging or development install without using up your license.
If you have other plugins installed that have their own integration settings, additional sections will be shown after the plugin license tab. Currently, there are integration tabs for WPML/WCML and the Aelia Currency Switcher extensions. Please see the respective docs pages for those:
Version 4 – Released November 2, 2021
- NEW FEATURE: You can now select roles that are allowed to use specific coupon codes. An “Allowed Roles” multiple select box has been added to the “Usage Restriction” section of the add/edit coupon page in WooCommerce. A “Guest” value is also included so that you can specify that a coupon can be used by non-logged in user. If you leave the field blank, the code can be used by any role (default).
- Database/Product update notices can now be permanently dismissed
- Updated licensing system to the latest version
- Tested with WooCommerce version 5.9.0 and WordPress version 5.8.1
Version 3 – Released April 11, 2020
- Version 3 is a MAJOR update, and it is STRONGLY recommended that you test it out on a staging or development server before updating on your live server.
- If you are using this in conjunction with Wholesale Ordering, you MUST also be using at least version 4 of Wholesale Ordering.
- Created a custom price meta table in the database to store min/max prices for products, similar to the product meta table WooCommerce created in 3.6. Currently this is mainly used for the price filter widget, but if you use the new feature to enable base price transients/caching, it is used to preload all the custom base price for all products for the current customer, which can help to speed up page load times on shop/category pages that show many variable products (especially if your variable products have many variations).
- Renamed the Sync tab in the settings to “Product Update Utilities” and added functions to set or adjust custom prices for all products, or by product category, as well as to update the custom price meta table
- If using in conjunction with Wholesale Ordering 4+, you can now also use the new Wholesale List price created by Wholesale Ordering as a base price for roles/users.
- Code changes to improve page speed loads on pages with lots of products, especially variable products
- Added compatibility with PolyLang for admin defined text strings
- If hiding a product without a base price for the current customer, you can now enable a custom single product page template that can be used to replace product content for products that user is not allowed to order.