WooCommerce Wholesale Ordering

WooCommerce Wholesale Ordering is an extension for WooCommerce. It will not work without WooCommerce.

General Info

Overview

This extension creates a new user role called “Wholesale Customer” which is the same as the “Customer” role that WooCommerce sets up, but with the added capability “order_wholesale”. The main purpose is to allow you to use one WooCommerce install, and one set of products, to sell to both retail and wholesale customers at the same time, with separate pricing and taxes.It adds a Wholesale Price input field for products and variations. Wholesale prices will ONLY be shown to users with the Wholesale Customer role, although there is an option that you can check to treat the admin user as a wholesale customer for testing.

It also adds a “Wholesale Only” check box next to the wholesale price fields. If this box is checked, those products, or variations, will be hidden from your shop for regular customers and visitors who are not logged in. This allows you to create products that are only for your Wholesale Customers.

In addition, there are separate tax settings for Wholesale Customers. You can either disable taxes completely for Wholesale Customers, or you can define your own default tax class for Wholesale Customers in addition to being able to specify the tax class for each product for Wholesale Customers.

This extension also adds an order type to each order. Order types are either “Wholesale” or “Retail”, and you can quickly filter the orders by either type in the main WooCommerce Orders list table.

You can also define custom messages for Wholesale customers, as well as modify the text for the prices shown.

Newest Features

Version 5 adds two new major features, the ability to select which payment methods are available to Wholesale and Retail Customers, and the ability to select which shipping methods are available to Wholesale and Retail Customers. Each of these has their own section within the Wholesale tab of the WooCommerce settings page. For more details on each, see the appropriate sections under Options/Settings.Version 4 is a major update that is mostly focused on optimizing the code and increasing page load speeds through use of caching/transients and other techniques. It also adds several new features:

  • Wholesale Product Meta database table – This new database table will store the basic wholesale data for simple and variable products (but not individual variations). This is to mimic what WooCommerce itself has started doing with its own product meta lookup table. Right now, it appears that WC mostly uses their own product lookup table for much more efficiently getting min and max prices for their Price Filter widget. In order to allow that price filter widget to work with wholesale prices, I had to setup a similar table with min and max wholesale prices for products that would be shown on shop/category pages, as they only way they now have of modifying the prices that the widget retrieves is by a filter hook on the database query itself. So, for now, that’s the main function of this table. But, WC has long ago stated that they intend to move more and more data away from the heavily burdened postmeta table and into their own custom tables, so I’m following suit with my own plugins to create similar tables.
  • Price Caching – In addition to the above mentioned table being used for the price filter widget, I have added an option to Enable Price Caching. If you check this new option, then all the data from the wholesale product meta table will be preloaded into an array and saved as a transient in WordPress. This includes the min and max wholesale and wholesale list prices. Although WooCommerce appears to load/cache all the data from the regular postmeta table for products when they are loaded (and all the wholesale data is still saved that way as well), enabling this new price caching feature appears to significantly speed up page load times as I don’t need to do multiple function calls to get each individual piece of product meta for every product that appears on the screen. This is most noticeable if you have a large number of variable products, each with a large number of variations. With the min/max prices for each being saved in the new database table, and being cached in a transient, there is no longer any need to loop through every variation for every variable product on the screen and figure out the min and max wholesale price (as well as the regular price if you were using those prices in the prefix or suffix for wholesale customers). Previously, I had been saving the min/max variation prices in meta data in the regular postmeta table, and retrieving those values if they exist (rather than always having to calculate from scratch), so the improvement over that method may not be as noticeable, but there are still fewer function calls per product if you enable price caching. The only downside is that the array of prices will be loaded into memory in a class variable on public pages. This would only be an issue if your WordPress install hasn’t been allocated very much memory and you have many thousands of products in your store. If you start getting out of memory errors, then you should probably leave the price caching disabled.
  • List Price – A new “List Price” field has been added above the Wholesale Price field for products. The purpose of this field is to create a faster and more efficient way of showing a “list” or “regular” price to wholesale customers via the wholesale price prefix or suffix fields. Previously, you could show the retail price in the prefix or suffix using the {retail_price} tag, but this was a processor intensive function as my plugin needs to override all the filter hooks in place that modify the regular price to change it to wholesale price for wholesale customers, and then retrieve and calculate the min/max regular/retail price for each product displayed, just so that could be shown in the wholesale price prefix/suffix. This could greatly slow down your site (even though I have some caching in place) if you have a lot of variable products on a shop page, each with many variations. So, the main reason for creating the list price was to give you an alternate “fixed” list price that you could use instead of the retail price to show to your wholesale customers. This price only needs to be set once, and the min/max list price values for variable products is also saved in the new wholesale product meta table, as well as the regular postmeta table. These list prices can thus be retrieved much faster without any additional processing of filter hooks and such. A new {list_price} tag has been added that you can use for the wholesale price prefix and suffix if you want to use list price to speed things up. Note that you can quickly set ALL your list prices to be equal to, or a percentage of, the regular/retail price using the Set Prices function on the new Update Products page.
  • Restrict Content – A new setting has been added which you can enable on the general settings section of the wholesale settings. This allows you to replace the single product page content with HTML content of your choosing (you create that in the Messages and Text settings section) to show to retail customers who somehow find a link to the single product page for a wholesale only product. Although, previously, they still could not order a wholesale only product, if they are not logged into a wholesale customer account, they would still be able to view the product. With this enabled, the single product page content template is replaced by the text/html you specify in the “Restricted Product Page Content” textarea at the bottom of the Messages and Text settings section.
  • Update Products – The “Sync” page in the Wholesale settings has now been renamed to “Update Products”. In addition to the Sync function for syncing the wholesale prices for Variable Products, there are now several additional functions you can run from this page. You can update the Wholesale Product Meta Table (which will need to be done at least once after the initial update to version 4), which also runs the Sync function (so you don’t need to run both). There are also functions to “Set Prices” and “Adjust Prices”. The Set Prices function allows you to set either the Wholesale Price or the new List Price using a multiplier applied to the Regular Price. You can choose to set prices for all products, or pick a specific category to only set prices for products in that category. You can also choose to keep, or overwrite, any existing wholesale or list price. The Adjust Prices function allows you to adjust the Wholesale Price or List Price by either a fixed amount or a percentage. Again, you can choose to do this for all products, or only the products in a specific category. Both of these functions work on Simple products as well as ALL variations of a variable product. Using these methods is much faster for making price adjustments for multiple products at once, especially since WooCommerce has no built-in method for adjusting the prices of more than one Variable product at once. The final new function is a Delete Transients function, which will force delete the transient that caches all the prices from the new wholesale product meta table. Normally, this transient would be deleted and recreated any time you update any product, but I put this function here for those who may be importing and updating products via some type of CSV importer which may not trigger the updated product actions. If you have not enabled Price Caching, you shouldn’t need to use this function as the transient would not be created or used.
  • Compatibility – Compatibility functions have been reworked and moved out into their own classes to only be loaded as needed. Many plugins are fully compatible without having to add any special compatibility functions, but if they modify prices at all, in any way, then chances are they are not compatible unless listed below. In addition to my own suite of WooCommerce plugins, here are the other plugins with specific compatibility functions added and tested for proper operation with Wholesale Ordering:
    • WPML/WCML
    • Polylang
    • Aelia Currency Switcher for WooCommerce
    • Germanized for WooCommerce
    • WooCommerce Dynamic Pricing
    • WooCommerce Product Add-ons
    • WooCommerce Measurement Price Calculator

Options/Settings

General settings

  • Enable Wholesale Ordering – This is just a quick way to turn the Wholesale ordering functions on/off without having to deactivate the plugin.
  • Disable Wholesale Payment – This just lets wholesale customers bypass payment, and will hide all payment gateways options at checkout. Useful if want to invoice wholesale customers instead of having them pay at the time of order.
  • “Wholesale Pending” order status – (added in version 2.8.2) If you have the “Disable Wholesale Payment” option (above) enabled, you can check this box to enable a custom order status called “Wholesale Pending”. The order status icon will look like the regular pending icon, but will be purple instead. This will then let you know that payment has not been made yet for the wholesale order. Note that since this is considered an “unpaid” status, if you have a time limit set to hold stock in the WooCommerce options, orders with this status will automatically get set to “Cancelled” after that amount of time if you don’t set them to a paid type of status (“processing”, “completed”).
  • Send emails for “Wholesale Pending” orders – (added in version 2.8.4) If checked, AND if wholesale payment is disabled, AND the “Wholesale Pending” status is enabled, the “customer processing” and “admin new order” emails will get sent for Wholesale Pending orders. Un-check this option if you do NOT want emails sent for Wholesale Pending orders.
  • Disable Wholesale Shipping – Bypasses all shipping calculations and charges for wholesale customers. Allows you to add that to their invoice manually later, or manually bill shipping to the customers shipping account, or however you want to handle shipping for wholesale customers.
  • Disable Wholesale Coupons – In most cases, since you are selling at wholesale prices, you don’t want your wholesale customers using coupon codes that were designed for retail customers, so you would normally leave this disabled so that they can’t enter coupon codes at checkout.
  • Disable Wholesale Stock Reduction – If you are managing inventory for your online store, but have a separate ordering system, or different inventory for wholesale customers, you can check this to disable the stock reduction for items in a wholesale order. This taps into a hook in the payment-complete function of WooCommerce, so will only disable the stock reduction for orders where payment has been completed (will work properly is you disable wholesale payments as that will act as if payment is complete and mark orders as “processing”). NOTE: If you are using the “BACS”, “Cheque”, or “Cash on Delivery” payment options, stock WILL be reduced as these payment gateways call the reduce_stock function directly, with no hooks included to bypass the function.
  • Allow Backorders – Allows wholesale customers to order out of stock items, or order a quantity larger than the amount in stock. Useful if you have a separate ordering system, and/or don’t count wholesale orders against inventory (above option). Note that this is a global setting, and will apply to all products. If you leave this un-checked, then the normal WooCommerce per-product stock/inventory and backorder settings will apply to wholesale customers also. If you want to allow backorders for wholesale customers, but you have some products that are not in stock even for wholesale customers, just set the wholesale price for those to blank, and they won’t be able to order.
  • Hide Stock Status – Hide the “in stock” or “out of stock” messages, along with the messages that show the number in stock, for wholesale customers. You should probably check this box if you are using the above “Allow Backorders” option, so that wholesale customers don’t get confused by any stock/inventory status messages.
  • Show Out Of Stock products – If checked, products set to “out of stock” will still be shown to wholesale customers, but only if Allow Backorders (above) is also checked. Leave un-checked to hide out of stock products from the shop pages for wholesale customers when you have the corresponding option set in WooCommerce.
  • Minimum Order Amount – Allows you to set a minimum order amount before the wholesale customer is allowed to checkout. If their cart total is less than this amount, they will see an error message on the checkout page (standard WooCommerce cart error message), and they won’t be able to checkout.
  • Minimum Order Message – Allows you to define the error message that appears on the cart and checkout pages if the minimum order amount has not been met yet.
  • Treat Admin as Wholesale User – Allows admin user to test the system and see and purchase products as a wholesale customer.
  • Wholesale Order Terms Page – Allows you to set up a terms page for wholesale customers. If you select a page here, the check box will appear at checkout that they must check to indicate they agree to the terms. If you don’t select a page here, the terms check box will not appear.
  • Allow FREE Products – Checking this option will show “Free!” and enable the add-to-cart button for products with a wholesale price of zero (0), so that you can offer free products to wholesale customers. Blank wholesale price fields are NOT considered free as of version 2.6.5. The wholesale price field must be set to the number zero for the product to be shown as free. If this option is NOT checked, but you enter a wholesale price of zero instead of a blank price field, the product will still show in the shop for wholesale customers (even if you check the option to hide products with no wholesale price), but they will see the no price text and not be able to add the item to their cart.
  • Wholesale Only Categories – Multi-select box lets you select categories that should only be displayed to Wholesale Customers. Categories you add here will be hidden from retail customers and guest in the main shop page (if you have it set to show categories) as well as in the WooCommerce Product Categories widget.
  • Retail Only Categories – Same as above, but these categories will only be shown to retail customers and guests. Logged in Wholesale Customers will not see these categories in either the main shop page or in the product categories widget.
  • Hide Wholesale Only products – Check this to hide Wholesale Only products from non-wholesale customers and guests (default setting). Un-check this option if you want to show all products to all customers. Un-checking the box will show Wholesale Only products to non-wholesale customers, but they won’t see the prices and they won’t be able to add the products to their cart.
  • Wholesale Only Price text – Allows you to define the short text that will appear in place of the price for Wholesale Only products when viewed by non-wholesale customers (if the above new option is NOT checked).
  • Restrict Content – Check this to replace the Single Product page content template with the custom restricted product content (set in the Messages and Text section) for Wholesale Only products viewed by non-wholesale customers. Although wholesale only products are filtered out of shop/category pages and widgets, if a retail customer finds a link to the single product page, they could still view that product (although they couldn’t order the product). This setting allows you to instead show some sort of restricted content message instead of the normal product page content.
  • Hide products without wholesale price – If checked, logged in Wholesale Customers will NOT see any products or variations that have no wholesale price set. NOTE: Beginning with version 2.6.5, the wholesale price must be blank for the product to be treated as having no price. A price of zero (0) will be treated as a free product, if you have that option enabled, or will show the no wholesale price message and still be visible if you don’t enable the free price option. If unchecked, they will see the No Wholesale Price messages below when a product or variation has no wholesale price (add to cart button will be disabled)
  • Make Wholesale Only Variations Inactive – If checked, variations that are set to wholesale only will not be able to be selected by retail customers, and may be grayed out (depending on your theme). If you leave this unchecked, they can select the variation but will get the No Wholesale Price Message for Product Variation, and they won’t be able to add the product to the cart.
  • Hide Prices until logged in – ALL prices and Add To Cart buttons will be removed if you check this option. Useful if you don’t want Wholesale Customers to ever see retail prices (such as when they are not logged in), but also forces site visitors to create an account and login before they can see prices or order anything. If this is checked, the next 2 options set what will be displayed instead of the price.
  • Not logged in Price text – The text that replaces the price is users are not logged in (when above option is checked). You can make this text into a link by entering a complete URL in the field below.
  • Login Link – This should be a link to your login/registration page, which, in most cases would be the Woocommerce “My Account” page, unless you are using a custom login/registration form. If you leave this blank, no link will be generated for the above text.
  • 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.
  • Delete WC Products In View Transients – This option allows you to delete the WooCommerce “products in view” transient on each page load to prevent WooCommerce from caching results from layered navigation and price filter widgets. On some systems this saved transient would cause incorrect values to show in the layered nav widgets when switching back and forth between wholesale and retail customers. Enabling this option will force WooCommerce to perform the layered nav queries on each page load (with the correct prices based on the current user) instead of using previously cached results. If you are not using any of the layered nav widgets (including price filter), or you are not experiencing this issue, then you should leave the new option disabled (un-checked by default).
  • Sync Batch Size – Allows you to set how many products to process per AJAX loop on the “Update Products” page (formerly the “Sync” page). If you have a fast server, you can increase this number to speed up the overall process. If you set this too high, your server may timeout before it can complete the processing of a batch. This setting applies to all the functions on the Update Products page, except for the Delete Transients function.
  • Enable Price Caching? – Turning this on can speed up page load times on shop/category pages with lots of products. This loads ALL wholesale and wholesale list min/max prices from the wholesale product meta table, in one database call, and stores that array in a WordPress transient. Once this transient is loaded, subsequent page views will load much faster. The transient is automatically deleted and recreated when any product is updated. You can also manually delete it from the Update Products page.
  • Wholesale New Order Email Recipient – If you want new order email notifications sent to a different email address for wholesale orders, enter the recipient email here. Leave blank to use the recipient email set in the regular WooCommerce new order email settings.

Taxes settings

  • Disable Wholesale Taxes – This will remove any sales tax from wholesale orders. Note that sales tax will still be shown on the cart page, but will be removed at checkout. The plugin allows you to set up a special wholesale customer message for the cart page, so that’s a good place to let them know that any taxes will be removed at checkout if you have disabled taxes for wholesale customers. With version 1.1 of the plugin, you can also use the next option to select special Wholesale tax classes.
  • Wholesale Tax Class – This allows you to select which tax class applies to wholesale customers, and only functions if you have the above option un-checked (wholesale taxes need to be enabled). If you leave this set to “Default”, then taxes will be calculated for wholesale customers the same way they are calculated for any other customer, except that the tax is calculated for the wholesale prices. To create a unique tax class for wholesale customers, you just create a new tax class from the “Tax” tab on the WooCommerce settings page. In the main “Tax Options” section, look for the textarea that says “Additional Tax Classes”. Type in the name for your new tax class on a new line, such as “Wholesale”. Then, save the settings, and on the same page you will now see a text link that says “Wholesale Rates” (assuming you named your new tax class “Wholesale”). Click on that link to define your new tax rates like you would for any other class, and then go back to the Wholesale settings tab and select your new tax rate from the select dropdown box. That tax class will now be used for Wholesale customers. If you don’t want your regular tax rates to show up on the cart page, you could create a Wholesale tax class, and then enter a 0 rate for all locations and call it “Tax Exempt”, and that will show up on the cart page and checkout instead for wholesale customers if you enable wholesale taxes and select that tax class.
  • Wholesale Shipping Tax Class – allows you to specify which tax class should be applied to shipping for wholesale customers. Previously products were taxed based on wholesale product tax class settings, but shipping was still getting taxed based on the regular WooCommerce settings. This setting will apply to public side orders as well as when you manually create orders from the admin orders page.
  • Wholesale Prices Entered With Tax – Choose if the wholesale prices you enter for products already include taxes or not. This is now an independent setting for wholesale customers (use the same setting on the regular Tax settings page to determine how you enter prices that retail customers will see). This setting, along with the next 2 settings, determine how prices are displayed and how taxes are calculated for wholesale customers. Please see the Independent Wholesale Tax Options section above for more detailed information.
  • Display prices in the shop: Choose if you want prices shown on the shop/product pages to be inclusive or exclusive of taxes.
  • Display prices during cart/checkout: Choose if you want prices shown on the cart and checkout pages to be inclusive or exclusive of taxes.

Messages and Text settings

  • Use WC info box styles – For the custom wholesale messages, if you check this option, they will be displayed in the standard WooCommerce info box style (which you theme might have modified). If you do not check this box, you can use the following options to define the message box styles, and a box with an X that can be clicked to close the box will appear instead.
  • Background Color – The background color for your message box if the above option is not checked.
  • Text Color – The text color for your custom message box.
  • Message Custom CSS – you can add custom CSS here to style your custom message boxes. CSS will be added inline.
  • Enable Shop Message – Enables the below message
  • Shop Wholesale Message – This message will appear to logged in Wholesale Customers on the main Shop page. You can use html to format your message.
  • Enable Shop Retail Message – Added in version 2.8.4, this allows you to enable/disable display of a custom shop page message for retail customers (guests and non-wholesale logged in users), which you can define in the below field.
  • Shop Retail Message – Message shown at the top of the shop pages for non-wholesale customers and guests if enabled (above). Uses same div classes and CSS styling as the messages for Wholesale Customers.
  • Enable Cart Message – Enables the below message.
  • Cart Wholesale Message – This message will appear to logged in Wholesale Customers on the cart page. You can use html to format your message.
  • Enable Cart Message – Enables the below message.
  • Checkout Wholesale Message – This message will appear to logged in Wholesale Customers on the checkout page. You can use html to format your message.
  • Wholesale Button Text – Text shown on the order button on the checkout page for wholesale orders. Set blank to use Woocommerce default button text.
  • Wholesale price prefix text – Text shown before wholesale price on shop and product pages. Set blank to only show price. Good way to let wholesale customers know they are seeing wholesale prices if you set this to something like “Wholesale Price:”. There is now a custom tag you can add to show the retail price in the prefix or suffix (below), in case you want to show a comparison of retail versus wholesale prices. To make the formatting nice, I added a tag for a line break. Since WooCommerce sanitizes these text input settings fields, removing all html tags, you have to use the conditional tags which my plugin will replace during output. NOTE: If you include the tag to show the retail price, the retail price will be shown along with its own suffix that you set on the WooCommerce Tax setting page.
  • Hide prefix if no retail price – Checking this will remove the entire prefix if the retail price is blank or zero. If you are using the retail price tag to show retail prices to wholesale customers in the prefix, then you can check this to hide that entire prefix when there is no retail price (so that you don’t see “FREE”, or something like “Retail: ” with no price after it).
  • Wholesale price suffix text – Same as above, but shown after the wholesale prices. This setting is separate from the one for retail customers that you can set on the WooCommerce Tax settings page.
  • Hide suffix if no retail price – Same as the Hide prefix if no retail price option, except for the suffix.
  • Only use Regular price in prefix/suffix – If you are using the prefix or suffix with the retail tag to show retail prices, check this to ONLY show the full regular price, even when a product is on sale.
  • Thank You Text – Replacement text for wholesale customers on the order received thank you page. Set blank to show the Woocommerce default “Thank you. Your order has been received.”
  • No Wholesale Price Message – Simple Product – Message wholesale customers see on the product page if there is no wholesale price for a simple product. You can use html for this message.
  • No Wholesale Price Message – Product Variation – Message wholesale customers see on the product page if there is no wholesale price for a selected product variation. Since each variation can have its own wholesale price (or no wholesale price), you may want a different message for variable products to tell them to try a different set of options. html is allowed.
  • Override variation template – Starting with version 2.5 of WooCommerce, the message that is shown when there is not a price for a specific variation of a variable product (when you select that variation on the product page) is controlled by a javascript template (not used by all themes). That made the message in the above setting not show for many themes. If this box is checked, that template will be replaced (for wholesale customers only) with a custom template that will show the above custom message instead. Un-check this option to use the default WooCommerce message instead.
  • No Wholesale Price Shop Message – A shorter message (text only) wholesale customers will see on the main Shop page if there is no wholesale price for a product or variation. This will show up where the price is usually shown, so you want to keep it short. If you need to style it differently, a class has been assigned to this message: class=”wholesale-noprice-shop-message”
  • Wholesale Only error text – Allows you define, or remove, the error message text shown to non-wholesale customers on the individual product page for Wholesale Only products.
  • Restricted Product Page Content – The single product page content (HTML allowed) that will be shown to retail customers if they view a single product page for a wholesale only product.

Update Products

This page doesn’t have any settings. Instead it has several functions for updating the wholesale product data in the database tables. These are all described in more detail in the Updating Products section.

Payment Gateways

This page shows all the available payment gateways (even if disabled in the regular WooCommerce settings) in a table, with check boxes for each and columns for Retail Customers and Wholesale Customers. The default setting for each type of customer is “All” which will show all available payment gateways to all customers. If “All” is checked, the rest of the check boxes for each payment gateway will be disabled. Uncheck the “All” checkbox to be able to select only the gateways you want to use for each type of customer.

Note that for Wholesale Customers, you will also need to un-check the “Disable Wholesale Payment” checkbox in the General settings section before any gateways will be shown.

Note that if any of the gateways are disabled in the WooCommerce settings, they will not show for either type of customer, no matter how you set the check boxes on this page.

Shipping Methods

This page shows all the available shipping methods you have created, organized by the shipping zones you have created. Similar to the Payment Gateways page, you can select which are available for Retail Customers and which are available for Wholesale Customers. The default value is “All” and if that is checked, the other check boxes for that customer type will be disabled. Note that if you want to use shipping methods for Wholesale Customers you must un-check the “Disable Wholesale Shipping” checkbox in the General settings section.

Rather than enabling/disabling an entire shipping method, such as “Flat Rate”, this page allows you to select specific shipping methods you have created within each zone. Thus, you could create multiple flat rate shipping methods in a zone, and assign some of them for Wholesale Customers and others for Retail Customers, allowing you to create different flat rate prices for each type of customer within the same zone. This works for other shipping methods as well. It’s a good idea to give each shipping item/rate within a zone a good descriptive name so you can remember which you created for Wholesale versus Retail customers.

This has also been tested to work with the WooCommerce Table Rate Shipping plugin. Similar to the Flat Rate method example, you could create one Table Rate method in a zone to use for Retail Customers, and another Table Rate method in the same zone to use for Wholesale Customers, giving them descriptive names such as “Wholesale Table Rate” and “Retail Table Rate” so that you know which one to check for each custom type on this settings page.

Wholesale License

Enter your license key for Wholesale Ordering here. A valid and active license is required for product support and automatic updates. The plugin will be fully functional without a license key (I don’t cripple my plugins in any way), but you will not get any product support, nor will you be able to get any plugin updates (bug fixes, security fixes, new features, etc.).

Integration Settings

If you have other plugins installed that have their own integration settings, additional sections will be shown after the wholesale license section. Currently, there are integration sections for WPML/WCML and the Aelia Currency Switcher extensions. Please see the respective docs pages for those:

Updating Products

Product Editor

Wholesale info for products can be added via the regular WooCommerce Edit Product pages. Simple products and product variations will have additional numerical fields added for the Wholesale Price and the List Price, plus a check box to set the product as Wholesale Only. In addition, simple products, and the parent variable products, will have two independent wholesale tax settings select boxes: one for the Wholesale Tax Status, and one for the Wholesale Tax Class. All of these fields are also available in the Quick Edit and Bulk Edit functions on the All Products page. However, note that you can not bulk edit Wholesale or List prices or Wholesale Only values for Variable products through the Quick or Bulk editors (for those you need to use the dropdown bulk variation editor functions).For Variable products, a Wholesale section has been added to the dropdown bulk variation editor which allows you to adjust Wholesale and List prices, in the same ways you can with Regular prices, and also toggle the Wholesale Only status for all variations of the product.

Update Products functions

The Update Products function can be found in the Wholesale plugin settings (WooCommerce > Settings > Wholesale > Update Products), and can be used to quickly set or adjust Wholesale and List prices for all products, or within specific categories. Prior to version 4 of this plugin, this was the “Sync” page. The Sync function also remains, as well as a new function to update the Wholesale Product Meta Table, and to Delete Transients. Most of these should be fairly self-explanatory. Note that all of these functions, with the exception of the Delete Transients function, will loop through products via AJAX loops, and each iteration will attempt to process the number of products you set as the Sync Batch Size in the General settings section of the Wholesale settings. If you have a fast/powerful server, you should be able to increase the batch size to speed up the overall process. If you get timeout errors, where the process hangs and doesn’t finish, you may need to reduce the batch size.

  • Sync Variable Products – This function has remained the same, and it will loop through all variations of each variable product, and save the min and max wholesale price for each variable product in a custom product meta field, as well as updating the min/max wholesale price in the new wholesale product meta table. Normally, your variable products are sync’d automatically any time you edit/update the product through the product editor. However, if you are using any kind of importer or custom bulk editor plugin, the variable product sync functions may not be triggered, and you may need to run this function manually to update the min/max wholesale prices. Note that the saved min/max wholesale price values are used to display the price ranges of variable products on the shop and category pages, and will greatly speed up page load time. If those values are not saved, then the plugin must loop through every variation of every variable product that appears on the current page to calculate the min/max wholesale prices, which will be much slower!
  • Update the Wholesale Product Meta Table – This is a new function that was added in version 4.0 of the plugin. After you update to version 4, and the new database table is created, you will need to run this function to populate the table with data from your existing products. This function will also run the above Sync Variable Products function while it’s updating Variable products, so no need to run both. Once this table has been populated, it will be automatically updated any time you update a product via the product editor. However, just like the sync function, you may need to run this manually if you are using any kind of importer or bulk editor plugins to update your product wholesale/list prices if those plugins don’t trigger the product updated actions.
  • Set Prices – This is a new function that was added in version 4.0 of the plugin. Here you can quickly SET wholesale or list prices for multiple products at once. The first select field allows you to determine if you want to set prices for ALL Products, or only the products in a selected category. You can then select the base price used to calculate prices, which can be either the Regular Price or the Sale Price (if you’re using Aelia Currency Switcher, base prices can also be selected for other currencies). The next input is where you specify the multiplier as a fractional value, which will then been multiplied by the selected based price of each product to calculate the wholesale or list price to set for the product. As an example, use a multiplier of 0.5 to set the wholesale price to 50% (half) of the Regular Price. Or, use a value of 1 to set the List Price the same as the Regular Price for each product. A value of 1.5 would allow you to set the list price to 150% of the Regular Price. Use the Target Price select field to select which prices you want to set, either Wholesale or List price (when using Aelia Currency Switcher, additional options will be added for each currency). The Overwrite existing prices? check box allows you to decide if you want to replace any existing wholesale/list prices with the new calculated price. Leave this un-checked to skip products where the target price has already been set, allowing you to quickly set prices for just those products where you haven’t set the target price yet.
  • Adjust Prices – This is a new function that was added in version 4.0 of the plugin. Here you can quickly ADJUST wholesale or list prices for multiple products at once. The first select field allows you to determine if you want to adjust prices for ALL Products, or only the products in a selected category. The second input is where you specify the target price to adjust, either Wholesale Price or List Price. The third input is to select which direction to adjust the prices, either increase prices or decrease prices. The fourth input is the type of adjustment, which can be either a fixed amount or a percentage. The final amount is the adjustment value, which should be a positive value. If you are using a fixed adjustment, then this is the dollar amount to adjust by, such as 1.50 to adjust by 1 dollar and 50 cents. If using a percentage adjustment, the percentage should be specified as a whole number, such as 10 for a 10% adjustment.
  • Delete Transients – This is a new function that was added in version 4.0 of the plugin. This function will delete any price transients stored in the options table. If you have enabled price caching (new feature in version 4), this will delete that transient and force it to be recreated. These price transients will normally be deleted and recreated any time you update a product. However, just like the sync function, you may need to run this manually if you are using any kind of importer or bulk editor plugins to update your product wholesale/list prices if those plugins don’t trigger the product updated actions.

Independent Wholesale Tax Options

Wholesale Ordering provides independent tax options for Wholesale customers. These are a bit complicated, and it took a while to figure out how to work around and bypass the regular WooCommerce tax settings.

This can be a bit confusing at first, so I will try to explain how it works. On the regular Tax page in WooCommerce Settings, one setting allows you to indicate if the prices you enter are inclusive or exclusive of taxes. Then, there are two select boxes further down the page that allow you to choose how you want to show prices, either including taxes or excluding taxes, with one choice for regular shop/product pages, and another setting for the cart/checkout pages. If you enter product prices that already include tax, but then want to display prices excluding taxes to customers, WooCommerce does some calculations to try to figure out what the base product price would need to be to end up with the price you entered after calculating the tax at the rate you entered.

Note that WooCommerce also allows you to specify a tax rate at the product level when you create/edit a product, as well as being able to set if the product is taxable or not, or to only tax the shipping.

Three of those settings have been duplicated on the Wholesale page in WooCommerce settings. You can now independently indicate if wholesale prices are entered inclusive or exclusive of taxes, and can also choose how prices and taxes are displayed in the shop and cart/checkout pages for wholesale customers. All three of these are separate and independent from the retail customer settings (those on the regular Tax settings page).

NOTE that these settings will only have an affect if you do NOT disable wholesale taxes! If you check the box to disable wholesale taxes, then the wholesale prices you entered will be what is displayed and charged no matter what you set any of the other tax settings to on the wholesale settings page. No taxes will be calculated if you disable taxes for wholesale customers.

In addition to those 3 settings, you can also choose a different tax class for Wholesale customers. If wholesale customers and retail customers have different tax rates in your country, you will want to create a new tax class for wholesale customers. Follow the instructions for “Wholesale Tax Class” in the Options/Settings section for how to set up a separate tax class. If the tax rates are the same for wholesale and retail customers, then leave the Wholesale Tax Class set to “Default” and it will use the same rate that you set up for each product or globally via the regular WooCommerce Tax settings, but the way you enter and display prices/taxes can still be shown differently.

Wholesale Tax Status and Wholesale Tax Class settings can also be set at the product level on the add/edit product pages (as well as quick edit and bulk edit forms). The default settings will be “taxable” for status, and “Global Wholesale” for the tax class.

These per product settings allow you to change tax status and tax class on a per product basis separately for retail and wholesale customers. If you leave the tax class set to “Global Wholesale” then that product’s tax class will be the same as the one you set up on the Wholesale page in WooCommerce settings. If anything other than “Global Wholesale” is set for the Wholesale Tax Class for a product, that tax class will override the global wholesale tax class for that particular product.

Of course, for any of these tax settings to be applied, you have to have taxes enabled in both the main WooCommerce Tax settings page, as well as enabling taxes (uncheck the “Disable Wholesale Taxes” check box) for Wholesale Customers.

FAQ

Wholesale Customer registration & account creation

This has been asked several times, and I originally put the detailed answer in the support forum in response to one such question, but I’m reprinting it here to make it easier to find for everyone.I don’t even attempt to create special logins or registration forms/pages for wholesale customers, since site registration and login is a personal thing and there are already a huge number of available plugins to modify the basic WordPress user registration and login functions. So, I don’t try to force people who buy my plugin into doing things in a very specific way.

As described above, this plugin simply creates a new role in WordPress called “Wholesale Customer”. All you need to do is to assign your “business” customers the Wholesale Customer role, and then they can view and purchase at wholesale prices.

For example, I originally created this plugin for my wife’s site, and she preferred to create the user accounts herself for her wholesale customers, and then simply email them their login info.

But, if you want your business customers to be able to register for a wholesale account via some type of online form, there are multiple registration form plugins you can use, as well as several custom form builder plugins. Some of these plugins can allow you to put the user account into a pending status until your approve their application. Others will allow you to define which role the users should be assigned when they register.

My favorite plugin for creating custom forms is Gravity Forms, but many people also like the free Contact Form 7. Gravity Forms has a user registration add-on which allows you to create a custom user registration form for your site, that will create user accounts with the role you specify when the form is submitted.

Even WooCommerce can create user accounts at checkout, so a first time customer can have an account created when they checkout for the first time.

I could go on, but there are quite a few options available for how to handle registration and login for your WordPress site. The customers of my wholesale plugin all have different needs and different ideas of how they want to handle that process. Because of that, and because there are already far too many plugins that handle that type of thing, I decided I would not include any of that redundant code in my plugin.

In short, all you really need to know is that you need to set the role to “Wholesale Customer” for your business users. How you want to do that is up to you. My plugin simply creates that role for you and checks for the “order_wholesale” capability in the user’s capabilities to see if they should be shown wholesale prices or not.