Many people who create a wholesale portion to their WooCommerce based e-commerce site will also want to add a section for wholesale customers containing information that pertains just to wholesalers.
This can be information like product documentation, display information, videos, and more. The defining characteristic is that it’s only targeted at wholesale customers, so it doesn’t make sense to just show this kind of information to everyone.
This guide will show you how to create a wholesale only area on your site so you can ensure that regular customers don’t stumble across it.
What you need:
- WooCommerce Wholesale Prices (and Premium if you have multiple roles)
- User Specific Content plugin by Brainternet
- Nav Menu Roles plugin by Kathy Darling
- A page you need to secure
Step #1: Install Wholesale Prices plugin
If you haven’t already, go and get yourself a copy of the wholesale prices plugin which will add the Wholesale Customer user role to your site.
If you need more levels of wholesale customers to separate different commitment levels then you should definitely check out the Premium add-on which adds the capability to add multiple wholesale roles.
Step #2: Install and configure User Specific Content plugin
The next plugin to install is the user content restriction plugin.
There are actually loads of different user content restriction plugins on the market, and in truth, it doesn’t matter which one you use, but I tried many different ones in researching this article and this one was very simple and achieved the task with minimal fuss.
Once installed you’ll find the settings page under Users->User Specific Content.
You can choose to set a global message that people see when they aren’t logged in or don’t have permission to see the page.
This message can also be customized per post/page if you’re going to be using this content restriction technique for other user types as well.
Protip: While you’re on the settings page, uncheck the “list user names?” option because this spits out all the user names on your site and any e-commerce site that has been running for a little while will have tons of them!
Step #3: Restrict the page access
The next step is to restrict access to the page.
Create a new page (or open the edit screen if you’ve already created the page) and you’ll see the new meta box to set the access rights.
It should look something like this:
Make sure you’ve only selected the Wholesale Customer (and whatever extra wholesale roles that should have access). These may show as checkboxes based on what you’ve selected in the general settings for the User Specific Content plugin.
I also like to choose the Administrator and Shop Manager roles, so that admins or shop managers logged in can see the content as well.
Step #4: Install and configure Nav Menu Roles plugin
The final plugin we’re using today is called Nav Menu Roles and what this does for you is gives you the ability to hide certain items in your site’s menus from certain users.
In our case, we’re going to be adding a menu item to point to our new page but will hide it from all users except admins and the Wholesale Customer role/s.
You can do this under the Appearance->Menus page by adding the new page to your menu and the configuring it like so:
Step #5: Test the front end
Now we have the whole lot configured it’s time to test.
When you’re not logged in and try to view the page (which you’d have to have a direct link for anyway) you’ll see your blocked message.
Once you login as a wholesale customer you should be able to see the hidden menu item and also the hidden content:
Now all that is left is to fill up your wholesale-only content with lots of useful stuff for your wholesale customers to use.
I hope you get some value from this guide! Leave a comment below and let us know what you used it for securing on your site.