Version 1.4 – Released January 4, 2017
This is a big update that largely adds new “Member Sales” and custom price “Display Settings”, in addition to some small fixes (mostly for Grouped products).
Scroll to the bottom for the release notes for version 1.4.
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).
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 If WooCommerce Wholesale Ordering is installed and active, and you have a role set to be treated as wholesale, , you can’t change settings for the Wholesale Customer role on this page, since those settings are done via the Wholesale Ordering plugin. If you do have 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 admin. 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!
- 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)
- 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.
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.
- 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.
Sync Variable Prices
This page doesn’t have any settings. Instead there is one button that allows you to manually synchronize all variable products in your shop. It does this 10 variable products at a time via an AJAX loop, to help prevent time outs if you have a lot of variable products. This will be required once when you first update the plugin to version 1.3 to synchronize and save the new min/max variation custom price meta fields saved with each variable product that help to speed up page load time when you have large numbers of variable products. After that, 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.
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.
The Sync function serves a couple of purposes, and saves several entries in the variable products post 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.
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 1.4 – Released January 4, 2017
- “Member Sales” feature introduced. When this option is enabled, if a sale price is less than the calculated member price (calculated from their base price and multiplier), the sale price will be used instead of the member price.
- New option to determine if a user/role price multiplier should be applied to sale prices. This setting will work with either the new “Member Sales” option, or if you have the “Use Sale Prices” option enabled (for users with default or regular price as their base price)
- New option to determine if a user/role price multiplier should be applied to wholesale prices when using the “revert” option. This will only apply when used in conjunction with the Wholesale Ordering plugin, and when a user/role is treated as wholesale, but using a price other than the wholesale price as their base price, and there is no base price entered for a product (thus reverting to the wholesale price).
- New “Display Settings” page in the User Role Pricing admin settings. This gives you a very powerful set of options for custom price displays for “members”, “non-members”, and guests.
- Fixes some issues with html prices displayed for Grouped products
Version 1.3 – Released August 1, 2016
- If using this plugin together with Wholesale Ordering, please make sure that Wholesale Ordering is also updated to at least version 2.8, and read the Wholesale Ordering and User Role Pricing integration notes
- This is a major update, and it is highly recommended that you test the update on a staging/development site first before deploying on your live site, or, at the least, have a very complete backup (home directory and database) that you can restore if something goes wrong. Although this plugin has been tested thoroughly, and it doesn’t do any direct database alteration, there are many settings and complex combinations, especially when used in conjunction with other plugins that it integrates with, and it’s impossible to test against every possible setting combination.
- Fully tested with the latest version of WooCommerce, which is up to 2.6.4 as of the date of this release. It is highly recommended that you update to the latest version of WooCommerce if at all possible (WC 2.6 is also a major update, so you should test your theme and all other plugins with it on a dev/staging server first as well).
- Complete WPML/WCML multilingual and multi-currency compatibility and integration. If you are using WPML/WCML with or without multi-currency, you should read over the new doc page: WPML Integration and Multi-Currency Support
- Complete Aelia Currency Switcher compatibility and integration. Complete compatibility and integration of all of your custom prices with the Aelia Currency Switcher, using any combination of automatic currency conversion, or manual entry of custom prices for each currency. Please see the dedicated docs page for Aelia Currency Switcher integration with User Role Pricing.
- Aelia Currency Switcher and WPML/WCML can be used together with User Role Pricing. Use WPML/WCML to translate your site and products to other languages, but use the Aelia Currency Switcher to handle multi-currency prices if you prefer the way it works to the multi-currency functions built-in to WPML/WCML.
- Many code improvements and behind the scene optimizations, especially when used with Wholesale Ordering, for better page load speeds.
- Manually sync variable products at any time. New AJAX based “Sync Variable Products” function allows you to synchronize variable products at any time. This will be required once when you first update the plugin to synchronize and save the new min/max variation wholesale price meta fields saved with each variable product that help to speed up page load time when you have large numbers of variable products. After that, 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 any of your custom prices, bypassing the normal product update action hooks, then you will need to manually synchronize your variable products again.
- Improved operation with the much better WooCommerce Price Filter widget in WooCommerce 2.6. The new changes and hooks made this integration with custom prices much easier and better (finally!).