We have created a video tutorial explaining how to use our WordPress password protect plugin to protect a WooCommerce category. The plugin lets you add password protections to a category and its products, or restrict it to specific logged in users or roles. Watch this alongside reading the knowledge base.
The tutorial tells you how to create a WooCommerce password protected category and private category in WooCommerce. It also explains the logic behind the plugin and how once you have protected a category, it will automatically protect all its products and any sub-categories too.
Here's a written tutorial for those of you who don't like videos:
Written transcript of WooCommerce Password Protect Category video
Before we learn how to password protect a WooCommerce category, you need to get the plugin on our website. Download the file and install it in the usual way for a WordPress plugin (Plugins → Add New → Upload), and also add the license key from your confirmation email.
Once you've got that all set up, you should have WooCommerce and WooCommerce Protected Categories installed on your website. You need both these plugins in order for WooCommerce Password Protect Category to work.
How to password protect a category in WooCommerce
Next go to Products → Categories in the WordPress admin. This is the usual page where you can create a WooCommerce category. If you've got an existing website then you probably have categories on the right already - that's fine. The process for creating a WooCommerce password protected category is exactly the same whether it's a new category or an existing one.
Let's great a new category. In the 'Add New Category' section on the left, add the following:
- Category name - e.g. 'Clothes'
- Slug - this is the last part of the category URL, e.g. 'clothes'
If you scroll down, you'll see that there's a new section at the bottom called 'Visibility'. This is what the WooCommerce Password Protect Categories plugin has added and it's not there by default in WooCommerce.
To password protect a WooCommerce category, you simply tick the 'Protected' option and enter a password, which can be anything you like. You can also set the category to only be visible to certain logged in users or user roles. Then click 'Add New Product Category'.
Click the plus (+) icon to add multiple passwords for a category. This lets you give different passwords to different customers.
This will add your new category in the list of categories on the right. In the 'Visibility' column, you can see that it is labelled 'Password protected'.
You can also restrict categories to specific users or entire roles. That way, they can automatically see the hidden content as soon as they log into their account. They don't need to enter a separate password.
Password protect sub-categories
You can also add sub-categories. If you have a sub-category, it will automatically share the same password. You don't need to password protect it - it just happens automatically.
Let's do this now and create a new category called 'Shoes'. I'm going to select the Parent as 'Clothes', and mark it as Public as I don't need to password protect it. Because this is a child category of a password protected category, it will be password protected even though it doesn't have its own password.
The great thing about that is that if you give your customers a password for the parent category, they can use it to access any of the products in that category, the child category page and any of the products in the child category. Customers only need to enter the password once and that whole area of the website will be unlocked for them.
That's much better than password protecting each individual product, which would be a nightmare for the customer because they'd have to enter the password for every single product they want to view. Not ideal!
If you want to create more complex structures for a password protected category, you can add other protected categories with their own password. For example, you might have a 'Furniture' WooCommerce category which is separate from the 'Clothes' category. You would add a different password to protect the Furniture category. That will work alongside the Clothes category and each will have a completely different password to protect it. If you give the customers who buy your clothes the password for the Clothes category, they will be able to access the Shoes category because it's a child category of Clothes. However they cannot access the Furniture category which is protected separately.
This is a good way to lock down lots of different types of WooCommerce store. For example you might use a password to protect a Trade section of your WooCommerce website and give the password to your trade distributors. You could give them each their own category and their own password. Or whatever the use case for you.
WooCommerce Password Protected Category settings
There are various settings for the WooCommerce Password Protect plugin in WooCommerce → Settings → Products → Protected Categories. These let you control how your protected WooCommerce categories appear on the main Shop page and in navigation menus and widgets. You can also customize the text on the password entry page.
Wrapping up our WooCommerce password protect tutorial
So that's how you set up the plugin and password protect a WooCommerce category. Give the password to your customers and they can buy from the protected categories.
For more information, check out our tutorials on how to hide a whole WooCommerce store and make it private, and how to use it as a WooCommerce wholesale plugin. If you want to protect an entire store, it's also worth looking at our dedicated private shop WooCommerce plugin.
Or sign up as an affiliate and earn 30% commission for recommending the plugin!