Wholesale visibility options
WooCommerce Wholesale Pro lets you choose which products are visible to your public customers, wholesale users, or both.
It does this by adding visibility options for each category.
Restricting access to categories
You will find a ‘Wholesale visibility’ section under Products → Categories. This contains the following options when you add or edit a category:
- Public and wholesale – the default; everyone can see this category and its products.
- Wholesale only – only logged in users with a wholesale role can see this category and its products.
- Public only – only guests or logged in users with a non-wholesale role can see this category and its products.
The category and its products will be hidden from the main shop page, wholesale store page, widgets, navigation menus and WooCommerce Gutenberg blocks for users who do not have access to them.
Category protection logic
Once you restrict a category so that only certain groups can see it, the same protection will automatically be used for all the products in the category, and any sub-categories.
This means that you only need to set the visibility options on the parent category, and you don’t need to edit the child categories.
What happens if you try to view a category you don’t have access to?
If a customer tries to access a category that they don’t have access to, then the following will happen:
- If they are a wholesale user trying to access a public category, then they will see a 404 error.
- If they are a public user trying to access a wholesale category, then they will be redirected to the wholesale login page.
What if a product is in more than one category?
We recommend keeping your category structure as simple as possible to prevent any logical errors. As a result, if you want to put the same product in more than one category, then we recommend nesting all of its categories under the same parent category. Don’t protect the sub-categories – instead, protect the shared parent category. The sub-categories will automatically inherit the protection from the parent category, ensuring that there are no visibility conflicts when the product is in multiple categories.
If you accidentally put a product in multiple categories which have conflicting visibility rules, then the following will happen:
- If the product is in a ‘Public Online’ AND a ‘Wholesale Only’ category – the product will be visible to public users AND wholesale users, regardless of which category you access it from. (For more reliable results, we recommend setting the visibility of both categories to ‘Public and Wholesale’.)
- If you are using WooCommerce Wholesale Pro AND WooCommerce Protected Categories and put a product in categories that are restricted by each plugin – the visibility rules for WooCommerce Protected Categories will take precedence and the WooCommerce Wholesale Pro rules will be ignored. (For more reliable results, we recommend ensuring that each product is in categories that are controlled by one plugin and not both.)
We have designed the plugin to work in all scenarios and your categories will never look broken, but it’s important to keep the structure logical and test carefully to make sure the visibility matches your expectations.
Restricting categories by specific users or roles
If you want more fine-grained control over who can see each category, then you can use WooCommerce Wholesale Pro with our other plugin – WooCommerce Protected Categories.
WooCommerce Protected Categories provides additional category visibility options, including the ability to:
- Restrict categories to specific user roles – for example, if you need each wholesale role to see different products.
- Restrict categories to individual user accounts – for example, if you sell branded clothing that is unique to each customer and require customer-specific categories.
Using WooCommerce Wholesale Pro with WooCommerce Protected Categories
When you use the two plugins together, you will see the visibility options for both on the Add/Edit Category screen:
Use the ‘Visibility control’ option to choose which plugin you will use to set the visibility for each category:
- Visibility – Use the advanced category visibility options provided by WooCommerce Protected Categories.
- Wholesale visibility – Use the visibility options provided by WooCommerce Wholesale Pro.
Each category is controlled individually, so you can use WooCommerce Wholesale Pro to control the visibility for some categories and WooCommerce Protected Categories for others. However, to avoid complications, if you have a hierarchical category structure (e.g. parent and child categories) we recommend using the same plugin to control all of the categories within this structure.
If a product is in multiple categories and you are restricting some with WooCommerce Wholesale Pro and others with WooCommerce Protected Categories, then this will cause a conflict and may have unpredictable results. While it’s fine for products to be in multiple categories, we recommend ensuring that each product’s categories are controlled by the same plugin with no overlap.
Can I create Wholesale Only product variations?
Please see our article on how to show specific variations to wholesale users only.
Can I create Public Only product variations?
This is a bit trickier and the only way to do this is to clone the product, use the category visibility to show one version of the product to public customers and the other for wholesale users, and add the appropriate variations to each one.
A customer has kindly provided a code snippet which you can use to hide specific variations from wholesale users programmatically.