Wholesale Ordering and User Role Pricing integration

My two most popular plugins, WooCommerce Wholesale Ordering and WooCommerce User Role Pricing, were designed to integrate with each other, and can be purchased as a bundle.

Version 2.8 of Wholesale Ordering and version 1.3 of User Role Pricing have even tighter integration, and built-in optimizations. If you are using them together, make sure to update both plugins to at least those versions, or there may be issues.

Optimizations

  • Redundant filter hooks were eliminated when both plugins are used together. Instead of having Wholesale Ordering modify product prices, and then have User Role Pricing step in to again check and modify product prices, User Role Pricing now handles all price filtering/modification when both plugins are active. Many of the Wholesale Ordering price related filter hooks are disabled when User Role Pricing is also active. This will speed up page load times when you have a lot of products on one page.
  • Variable Product Sync functions are shared with a common Variable Product Helper class. Rather then duplicating the same code across two plugins, with the only modification being the meta keys for the prices, one helper class has been created to handle these functions, with the price keys being passed in by each plugin as needed. Although both plugins contain a copy of this helper class, only one will be used and loaded into memory (thus, it’s important to keep both plugins up to date with latest versions). In addition, if both plugins are active, you can run the “Sync Variable Products” function from the User Role Pricing settings page and there will be a checkbox to also include wholesale prices so that you don’t have to run the function separately from the Wholesale Ordering plugin page.
  • Min/Max variation prices are now saved in custom post meta fields for all custom prices (wholesale price plus any custom prices created with User Role Pricing). This will speed up page load times on shop/category archive pages when you have a lot of variable products in your catalog, especially when they have a lot variations. When you sync your variable products (also happens automatically on an individual product basis whenever a variable product is updated in admin), the min and max variation prices are saved for each Variable product. When displaying the products, the HTML price range shown for each product is generated by using these saved values. If the saved values don’t exist, then the plugin needs to loop through every variation for every Variable product and re-calculate the min and max values for the currently displayed price (wholesale or custom prices).

Integration

The main advantage of using Wholesale Ordering and User Role Pricing together is that you can have multiple pricing tiers, or levels, for both retail and wholesale customers.  With Wholesale Ordering by itself, only users who you set to the “Wholesale Customer” role are treated as wholesale customers, and can buy at wholesale prices and have separate tax settings, and all the other features of Wholesale Ordering (such as enable/disable taxes, shipping, payment at checkout, etc.).  When Wholesale Ordering is used with User Role Pricing, you can set up other roles, or even individual users, to be treated as Wholesale Customers. This means that you can apply the independent tax settings and other options of the Wholesale Ordering plugin to other roles or individual users, but you can give them different pricing levels by choosing a different base price and/or multiplier.

Some duplicate/redundant settings are remove or disabled in Wholesale Ordering when User Role Pricing is active, and some settings are shared between the two plugins. These will be noted on the respective settings page.  For example, the setting to “Hide products without wholesale price” will be disabled in Wholesale Ordering, because the action on what to do when there is no base price is set in User Role Pricing, with more options (revert, hide, or custom message).