Woocommerce Wholesale Ordering is an extension for WooCommerce. It will not work without Woocommerce. It is in use on my wife’s site which we always keep up to date with the latest versions of WordPress and Woocommerce.
Version 2.8 – Major update – released August 1, 2016
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.
Scroll to the bottom for version release notes.
This extension creates a new user role called “Wholesale Customer” which is the same as the “Customer” role that WooCommerce sets up, with the added capability “order_wholesale”.
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.
Version 1.2 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.
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.
Options for the plugin are found under the Wholesale tab of the WooCommerce Settings page.
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.
Independent Wholesale Tax Options
Versions 1.3 and 1.4 added 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. A client requested this update since they needed to enter and display prices and taxes differently for retail and wholesale customers.
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 setting if the product is taxable or not or 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 below 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.
NEW in version 2!
Version 2.0 of the Wholesale Ordering plugin adds per product Wholesale Tax Status and Wholesale Tax Class settings to 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, so that it won’t affect the way taxes are calculated if you upgrade from a previous version.
These new, 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 the main Woocommerce Tax settings page, as well as enabling taxes (uncheck the “Disable Wholesale Taxes” check box) for Wholesale Customers.
The descriptions next to each option should be fairly obvious, but I’ll explain each of the options that appear in more detail:
General settings section:
- 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 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.
- 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).
- 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).
Taxes settings section:
- 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 section:
- 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.
- 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.
Sync Variable Products section:
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 2.8 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 wholesale prices, bypassing the normal product update action hooks, then you will need to manually synchronize your variable products again.
The Sync function serves several purposes, and saves several entries in the variable products post meta table:
- It saves a wholesale price meta value 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 Wholesale Ordering, this is used to determine if the variable product should be shown in the shop if you have it set to hide products without wholesale prices from wholesale customers (the “retail only” products).
- It saves a “wholesale only” meta value for the parent variable product. Similar to the above, it loops through all variations, and if they are ALL wholesale only products, then the parent gets a “yes” value for wholesale only. If ANY of the variations are NOT wholesale only, then the parent gets a “no” value for wholesale only. This is used to add a simple meta query to the WooCommerce main product query so that wholesale only products can be hidden from retail customers on the shop pages.
- It saves separate min variation wholesale price and max variation wholesale price meta fields 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 values every time the page loads.
Wholesale License section:
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.).
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:
Quick Edit and Bulk Edit
For simple products, you can edit/change wholesale price and wholesale only options for products with Quick Edit and Bulk Edit. Since each variation in a variable product has its own wholesale price and wholesale only checkbox, quick and bulk edit of those fields won’t work on variable products.
Variable products have their own variations bulk edit function included by WooCommerce, and I have added wholesale price functions to that mimic the WooCommerce functions for regular and sale prices. I have also added a Wholesale Only toggle bulk edit function for the variations as well.
Version 2.0 also adds Wholesale Tax Status and Wholesale Tax Class to the quick edit and bulk edit forms for each product.
Version 2.8 release notes – August 1, 2016
- 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 Wholesale Prices with the Aelia Currency Switcher, using any combination of automatic currency conversion, or manual entry of wholesale prices for each currency. Please see the dedicated docs page for Aelia Currency Switcher integration with Wholesale Ordering.
- Aelia Currency Switcher and WPML/WCML can be used together with Wholesale Ordering. 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.
- Multi-Currency support for minimum order amounts for wholesale customers. Minimum order amounts can be entered manually for each currency (if, for example, you want nice round values), or they can be calculated automatically based on the current exchange rates. Works with either WCML Multi-Currency or the Aelia Currency Switcher.
- Many code improvements and behind the scene optimizations, especially when used with User Role Pricing, for better page load speeds.
- If using this plugin together with User Role Pricing, please make sure that User Role Pricing is also updated to at least version 1.3, and read the Wholesale Ordering and User Role Pricing integration notes
- 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 wholesale 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!).
Version 2.7 release notes
- Removed the system of saving the 2 arrays of product IDs for wholesale only and no wholesale price products, as this was not very efficient and could slow things down on systems with a very large number of products. This has been replaced by adding some meta queries to the main WooCommerce product query. These queries only get added when your hiding wholesale only products from retail customers, and/or hiding products without any wholesale price from wholesale customers (“retail only”). These additional queries will check the wholesale values and hide products that don’t meet the conditions.
- Version 2.7.1 fixed an issue with the new meta queries by creating “_wholesale_only” and “_wholesale_price” meta fields for parent variable products, by “syncing” all the published variations to determine if the parent variable product should be considered wholesale only or retail only. This is similar to what WooCommerce was already doing for regular/sale prices for variable products. However, this requires a one time update of all variable products in your store to make sure all of them have those values set. After that one time update, individual variable products will be re-synced any time you edit and update the product.
- Please note: If you have a very large number of variable products and variations, the one time update process mentioned above may time out on your system. If this is the case for you, please contact me and I can send you a simple plugin that will update all your variable products in the background (use one time, and then delete the plugin).
- Version 2.7.2 added an option that 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).
Version 2.6.11 released October 15, 2015
- Lots of logic and bug fixes since the last noted release below. Several combinations of settings, especially when used with User Role Pricing, produced some unexpected results, especially after the change for the free and “no price” logic.
- Compatibility functions added for VarkTech Pricing deals.
- New option added to force 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.
Version 2.6.5 released September 25, 2015
Changed the logic for free and “no price” products for wholesale customers. Now, a product is considered free for Wholesale Customers if you enable free products and only if you set the price to zero (0). Blank prices are now considered “no price”, and products with a price of zero are considered to have a price. So, you can now have some products be free for wholesale customers, while at the same time hiding products without a wholesale price. If you uncheck the Allow FREE Products option, wholesale products with a price of zero will still show to wholesale customers even if you are hiding products with no wholesale price, because zero is now considered a price. However, if you are not allowing free products, they won’t be able to order those products with a zero price.
Version 2.6.4 released September 24, 2015
- “Hide Wholesale Only products” option in general setting section. Checked by default so that the prior behavior doesn’t change. You can now 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” option 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 un-checked).
- “Wholesale Only error text” in the Messages and Text settings section now allows you define, or remove, the error message text shown to non-wholesale customers on the individual product page for Wholesale Only products.
Version 2.6.0 released September 8, 2015
- Added compatibility with the WooCommerce Product Addons plugin. Works for both wholesale and retail customers.
- Added an option to allow wholesale customers to backorder products.
- Added an option to not show stock status and inventory to wholesale customers (useful when used with above new option).
- Modified the way that wholesale vs retail customer and prices are set on the admin edit order page for manually creating or editing orders.
Version 2.5 released July 19, 2015
- Added a Wholesale Shipping Tax Class to the plugin settings (Taxes section) to allow 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.
- Modified the way wholesale info is displayed and saved for variations of a variable product to be compatible with the upcoming 2.4 version of WooCommerce (still in beta) which now saves variations via AJAX. These new modifications to my plugin are still compatible with current versions of WooCommerce.
- Add compatibility with WooCommerce Measurement Price Calculator.
- Add Lithuanian translation files from Lukas at shopideas.lt
- Mostly behind-the-scenes code optimization and a bit of cleanup. Now the plugin stores a list of “wholesale only” products, and a list of products with no wholesale price, in the WordPress options database table to speed up the process of checking for products that should be hidden from one user type or the other (depending on your settings). These lists will be automatically updated any time you edit/save a product in the admin dashboard. This way the plugin doesn’t have to iterate through all products with each Woocommerce product query to determine which ones to remove from the query. This will speed up page load times if you have a LOT of products in your catalog.
- Products that should be hidden from wholesale or retail customers (depending on your settings) will now also be hidden within the Woocommerce widgets as well, or from any non-loop (shop type page) product display that uses a WordPress query to retrieve products. WooCommerce has their own query class for the main shop/categories loops that I hooked into previously, but WooCommerce uses a more generic WordPress post query for their widgets, so I had to find other hooks to tap into to remove the products from those queries.
- Updated the translation file with one string in the admin settings that was omitted.
- Changed an early call to a WooCommerce function, added in 2.2.0, that could potentially cause a fatal error if somehow WooCommerce was not fully initialized before my plugin.
- Since several customers had previously created a Wholesale Customer role before installing my plugin, my plugin will now check for that role and add the needed capability to make my plugin work correctly with the existing role (if that capability doesn’t already exist). This is only done once during plugin activation. If the role doesn’t exist, my plugin will create the role with the needed capability.
VERSION 2.2.0 – released May 7, 2015
- Added “Wholesale Only Categories” and “Retail Only Categories” to the Wholesale Orderings settings page. You can select multiple product categories for each option to only show those categories to the respective customer type. Works to hide categories from the other customer type in the main shop loop (when showing categories) as well as the categories widget.
- When manually editing or creating orders from the admin dashboard, prices for any added products will now be based on the role of the selected customer. Added a Customer Type display that will refresh via AJAX when you select a different customer. The Order type will also update based on the user role. Changing the order type independently does not affect pricing (based on user role only), and you will see a message if there is a mismatch.
VERSION 2.1.1 – released April 26, 2015
Added new check box options for both the wholesale prefix and suffix text to not show the prefix or suffix is there is no retail price for a product. This is useful if you are using the tags to show retail price in either the prefix or suffix, but don’t want the retail price to show for wholesale only products. Then you can leave the retail price blank or set to zero, and not see “FREE” for retail price.
Also added a “Wholesale Only” check box to Grouped products so that the parent grouped product can be hidden from retail customers, in addition to whatever products belong to that group.
VERSION 2.1 – released April 24, 2015
This version adds the option to force users to be logged in before they can see prices and order anything. The option is turned off by default. If you enable the option, you can define the text that will appear in place of the prices, and also optionally define a link to your login/registration page (or My Account page for Woocommerce). Add-To-Cart buttons will also be removed (otherwise they could simply add something to the cart to see the price). This is useful if you don’t want Wholesale Customers to be able to see the retail prices, but will also force guests to create an account and login before they can see prices and order.
This version also changed the Wholesale Settings functions to the newer way that Woocommerce defines settings pages, and breaks apart the long list of wholesale setting into 3 new sections, so you don’t have to do so much scrolling.
VERSION 2.0 – released April 19, 2015
There are a LOT of changes in version 2 of this extension, and it is strongly recommended that you make backups of your current system and/or test on a development server first. Version 2 takes advantage of some of the newer features in the latest versions of Woocommerce, and thus it is not guaranteed to work properly with versions of Woocommerce before version 2.3.
The biggest changes were in the re-factoring and simplifying of the code, particularly with regard to all the independent tax settings. I found a better way to override some of the Woocommerce tax settings that are retrieved directly from the WordPress Options database without any filter hooks. By intercepting the get_option call and changing what is returned for wholesale customers, I was able to eliminate a lot of the code that I had used previously to change some of those settings in the Woocommerce cart calculations. This also resulted in being able to use less hooks to set the wholesale prices as well. Hopefully this will improve compatibility with other Woocommerce extensions, although, sadly, it still doesn’t make the Dynamic Pricing plugin work for wholesale customers (still working on trying to find a solution for that one).
Another big change is WPML compatibility. Wholesale Ordering is now mostly compatible with WPML. For the majority of WPML users, Wholesale Ordering will now work fine for translated products for both retail and wholesale customers. If you use multi-currency, the next update (this was written on April 19, 2015) of WPML should include a few small changes that I submitted to them to allow automatic currency conversion for wholesale prices. As of right now, the only part that is not compatible is if you set WPML for manual entry of prices in different currencies. That requires quite a bit more modification of the WPML plugins, and I will be working with them to try to get them to add some action/filter hooks to allow other plugins, such as mine, to add and save custom price fields, such as the wholesale price field.
Along with the WPML compatibility, I have added a small amount of code to modify a template used by the Germanized plugin so that the tax incl/excl sub text that it puts under prices will be shown correctly for wholesale customers.
Allow FREE Products for Wholesale Customers. With this new setting enabled, you can now offer free products to wholesale customers. Please note, however, that you will have to turn off the option to hide products without a wholesale price.
The last big change was the addition of per product wholesale tax status and wholesale tax class settings. You can read more about that in the independent tax options section below.
One minor additional feature is a new Minimum Order Message text field option, allowing you to modify the error message shown to wholesale customers on the cart and checkout pages if the minimum order amount has not been met yet.