Installation & basic setup
WooCommerce Protected Categories provides an easy way to password protect your product categories or restrict them to specific user levels or roles. This is how to set up it.
1. Install the plugin
Once you have purchased WooCommerce Protected Categories, you should receive a confirmation email which contains your license key and a download link to the plugin. If you don’t receive this email, please check your spam folder. If it’s not there, please send us a support request.
Your confirmation email also contains a link to download your purchase invoice as a PDF.
Once you have downloaded the plugin, go to your WordPress admin, then go to Plugins → Add New → Upload Plugin. Click Choose File and select the woocommerce-protected-categories.zip file you just downloaded. Once uploaded, click Activate.
Note: WooCommerce Protected Categories requires the free WooCommerce plugin to work. If you can't see the plugin settings page, make sure you have WooCommerce installed.
2. Enter your license key
Once activated, go to WooCommerce → Settings → Products → Protected Categories and enter your license key. This should be contained in the email confirmation that was sent to you after purchase. Click Save Changes to validate and store your license key. If you get an error saving your license key, please try a second time. If the error persists, please view the article on license key problems.
3. Configure the plugin settings
You will also find the settings for the plugin in WooCommerce → Settings → Products → Protected Categories.
Note: These category visibility settings only apply to password, role or user protected categories. Categories marked as 'Private' will always be hidden from the public parts of your store, regardless of these settings.
Show protected categories & their products in public-facing store
Tick this box if you would like your protected product categories to be visible in your public-facing WooCommerce store. This will show protected products on your main shop page, on category pages, archives and in search results. It will also show protected categories in the product categories widget. Untick this option to hide protected categories and products.
Show protected categories & their products in navigation menus
Tick this box if you would like protected categories and their products to display in navigation menus. This works for products and categories that you have added to the menu via the ‘Products’ and ‘Protect Categories’ section in Appearance → Menus – it does not work if you have added them as ‘Custom Links’.
Please note that unticking these boxes only affects the visibility of protected categories for users who have not yet unlicked the category. Once someone has entered the correct password, the category will be ‘unlocked’ to them and will display on the main store page and in the menu for that user, regardless of whether these boxes are ticked.
Ticking this box will automatically add ‘Protected:’ or ‘Private:’ before the name of the category and its products, wherever it appears on the website. For example, if you have a password protected product category called ‘Shop’ then it will display as ‘Protected: Shop’; and if you have a private category called ‘Shop’ then it will display as ‘Private: Shop’.
The prefix will appear on the category page, shop front, menus and widgets.
Private, user and role restricted categories
The following options apply to WooCommerce product categories that are restricted to specific roles or users.
When logged out
Choose what happens when someone without the correct privileges tries to access a role or user protected category:
- Show 404 error - Display a 404 error, so it appears as a broken link. This is a good way to hide the fact that the hidden category and its products even exist.
- Show WordPress login page - Redirect people to the default WordPress login page (/wp-login.php) so that they can log into their account.
- Show custom page - Alternatively, select any page on your website for people to be redirected to.
Note: If a category is password protected as well as restricted to specific roles or users, then this option will be ignored and the password login form will be shown instead.
This option appears if you select 'Custom page' in the 'When logged out' dropdown. It lists all the pages on your WordPress website.
Choose which page you'd like people to be redirected to when they try to access a role or user protected category. For example, you can select a front end login page if you have one (if not, then we recommend the free Theme My Login plugin for this). Alternatively, if you're creating members-only categories then you could redirect people to a page that explains that the content is for members-only with details on how to join.
Password protected categories
The following options apply to WooCommerce password protected categories.
Enter a whole number of days, after which the password will expire. This works by adding a cookie in the user's browser. The minimum cookie expiry period is 1 day and the maximum is 9999. On entering a correct password, users will be able to access the category for the set number of days without having to re-enter a password.
Password entry page
You can set a page which your customers or clients can use to login to a password protected category from a central point. The page will display a password entry form where the user can enter a password. If they enter a correct password for any category, they will be taken to the page for that category with the products unlocked and displayed.
The plugin will look for a category that matches the password entered, and if it finds a match, it will redirect to the first category found. For this reason, it makes sense to use different passwords for each category.
Setting this option will add the
[category_login] shortcode to the page.
Tip: You can also add this shortcode directly to any other location on your site, such as additional pages, sidebar widgets or your website header or footer. Simply paste the
[category_login] shortcode where you want the login form to display. Click here for more information about the central login page.
Use this option to customise the heading that appears at the top of the password login form, above the message and password entry box.
You can enter some text here to customise the wording that appears on the password login form, above the password entry box. Anything that you enter here will replace the default text.
You can format the text using HTML code to add lists, images etc. as required.
The text that appears next to the password entry box.
Tick the box if you would like to use the ‘Password Label’ (see above) as a placeholder for the password entry box.
You can change the text that appears on the ‘Submit’ button for the password entry form.
Password container class
If you enter a CSS class here, it will be used in the container element that surrounds the password entry form. This might be useful if your relies on full-width page templates and you want to ensure the password form has a contained width.
4. Start protecting your product categories!
Once you have installed the plugin and activated your license key, you can start creating protected WooCommerce categories!
Plugin installation & setup service
If you don't want to set up the plugin yourself, the one of Codeable's WordPress experts will be happy to do it for you. They can install and set up WooCommerce Protected Categories to meet your exact requirements.
To book the plugin setup service, simply click the 'Get Started' link above and enter your information. The price and project description have been pre-filled for you. You should read through the description and add information about which protected categories you need and the type of protection you require. You can then submit the project, and a Codeable expert will contact you soon.