Need to create a private WooCommerce category that only authorized users have access to? With the right tools, you can make one or more categories on your store completely private.
Then, you can either give automatic access to certain user roles that you specify or give users a password that they can use to access the private category.
This comes in handy if you need to create a:
- Separate category of wholesale products that only certain users have access to.
- Private category that’s just for members, like if you’re running a membership site and want to offer a special set of products to just those members.
- Your own niche use. I’m sure you can think up lots of other site-specific uses!
I’ve already shown you how to create password protected WooCommerce categories. Now, I’m going to give you a tutorial on how to adopt the same plugin to creating a private WooCommerce category.
WooCommerce Password Protected Categories Lets You Create A Private WooCommerce Category
To create a private WooCommerce category, you’ll need the WooCommerce Password Protected Categories plugin from Barn2 Media.
Basically, the process works like this:
- You use the WooCommerce Password Protected Categories plugin to make one or more WooCommerce categories private
- Then, you use the free User Role Editor plugin to assign the capability to access those categories to certain user roles.
Once a category is private, it’s completely hidden from your store, along with all products in that category. Note that, unless you take further steps, direct links to individual products will still work. More on this later.
Of course, you can always add password protection instead of making the category private in this way, If you’d prefer to use password protection instead of restricting access by user role, read this post for a tutorial specifically on that subject.
How To Create A Private WooCommerce Category
To get started, make sure that you have the WooCommerce Password Protected Categories plugin installed and activated on your WooCommerce store.
Then, you’re ready to jump in!
Step 1: Make Category (Or Categories) Private
Once you have the plugin installed, you can make categories private by going to Products → Categories in your WordPress dashboard.
There, you can either:
- Create a new category that you want to be private
- Edit an existing category to make it private
The interface is the same for both options.
At the bottom of the interface, you should see a section for Visibility. In that section, select the radio box for Private:
Now, if you look at your list of categories, you should see that specific category marked as Private, which helps you remember which categories are public vs private:
And if an unauthorized user tries to access that category on your store, they’ll see a message like this:
Additionally, that category, and all the products and subcategories inside of it, will be hidden from all parts of your store, including navigation menus.
Step 2: Create New User Role To Access Private Categories
By default, the only people that can see your private categories are users with the user roles of:
- Shop Manager
For some uses, that might be enough. But if you want to allow other people to access your private categories, you’ll probably want to create a separate, more limited, user role that you can use for those people’s accounts.
For example, you could create a “Private Category Shopper” user role that you assign to those users that only gives them access to the private WooCommerce categories, but not any other permissions. Or, you could always utilize the existing WordPress Subscriber role, depending on your needs.
To create a new user role, you can use the free User Role Editor plugin.
Once you’ve installed and activated the plugin, go to Users → User Role Editor in your WordPress dashboard.
Then, click the button to Add Role:
Give your role a name, like “Private Category Shopper”, and then click Add Role.
Optionally, you can choose to Make copy of the existing WooCommerce Customer role if you want to ensure your new user role has all those same capabilities plus access to private categories:
And now you have a new user role called Private Category Shopper!
Step 3: Add Relevant Capabilities To New User Role
Right now, the new user role that you just created doesn’t have permission to do…anything (or, it might be an exact copy of the Customer role if you chose to make a copy).
Let’s fix that!
To give the new user role permission to access your private WooCommerce categories, check the boxes for:
Then, click the Update button:
If needed, you can add other capabilities as well. But those four alone will give that user role access to the private categories.
Step 4: Create Or Edit User Accounts For Your Private Shoppers
Now, to give access to your private categories to certain users, you can assign them the role of Private Category Shopper when you create or edit their WordPress user account:
As long as the users are logged in, they’ll now be able to see all of your private categories.
You Can Also Make Individual Products Private
As I mentioned at the beginning, the method above makes the categories private and hides all the products in those categories from all parts of your store.
But…if someone were to get their hands on a direct link to a product in a private category, they could still access that specific product.
While this is probably a rare situation, there is a solution if you’re worried about it happening:
Use the core WordPress Visibility feature to make individual products private:
Users with the proper role will still be able to view the individual private products, but it will ensure that no one else, not even someone with a direct link, will be able to view the product.
Wrapping Things Up
WooCommerce Password Protected Categories is an easy-to-use solution if you need to create private categories on your WooCommerce store. Remember, all you need to do is:
- Install and activate the plugin
- Mark specific categories as private
- Optionally, create a new user role and add capabilities to give certain users access to your private categories
WooCommerce Password Protected Categories can also be used to create password protected WooCommerce categories in addition to completely private categories. And, if you’d prefer to make your entire WooCommerce store private, the same developers offer a separate WooCommerce Private Store plugin.
Have any other questions about how to create a private WooCommerce category? Leave a comment and we’ll try to help out!