As an online store owner, there are many ways you can benefit from using a plugin that lets you hide categories in your WooCommerce store.
For instance, you could sell certain products to certain customers or set up a members-only section in your WooCommerce store. And although WordPress and WooCommerce are powerful, feature-rich tools, they don’t offer this functionality out of the box.
In this article, we’ll show you how you can hide categories in your WooCommerce store – in two different ways. By the time you’re done reading, you’ll be able to hide categories using a password or restrict access to specific user roles (or individual users).
Why you’d want to hide categories in your WooCommerce Store
Being able to hide categories in your WooCommerce store makes it easy for online store owners to hide multiple products at once instead of hiding individual products.
- You can create private products. Hiding categories in your WooCommerce store allows you to create private products that you can make available to some of your customers. For instance, if you wanted to offer subscribers access to special products, you could send them a code via your email newsletter that grants them access to the private products in your WooCommerce store.
- Sell products to specific users/customers/clients. You can hide categories in your public-facing WooCommerce stores and make them available to specific users, customers, or clients only. One way to do this is by creating a hidden (private) section in your store that only the customer can access after using a specific password.
- Members-only club. Hiding categories also gives you the option to create a members-only club implementation in your WooCommerce store. This way, users can only purchase the products in the private store after logging into their accounts.
The problem with simply hiding individual products from your online store is that anyone with a direct link can access them. A better solution is to have an implementation – such as the WooCommerce Protected Categories plugin – that makes the product categories private. This way, only users and customers with the right user role privileges or the correct password will be able to access the products you decide to make private.
How does the WooCommerce Protected Categories plugin work?
WooCommerce Protected Categories is a WordPress plugin that lets you hide categories in your WooCommerce store.
You have the option to hide a single category or multiple categories. When you hide categories in your WooCommerce store using the WooCommerce Protected Categories plugin, all of the products marked with the category will be hidden from your online store.
Here’s how users can access hidden categories in your WooCommerce store:
Using a password or code
When a user click on a link leading to a hidden category page or a hidden product, they’ll be asked to enter the password (or code) to access the page.
Once the user enters the correct password, the WooCommerce Protected Categories plugin will automatically unlock all of the products in that category. The user will then be able to browse all products in the category (and any sub-categories) without having to re-enter the password.
With the correct user roles
By default, WordPress creates five user roles – Administrator, Editor, Author, Contributor, and Subscriber – each with different permissions. When you install WooCommerce to your WordPress site, two additional user roles will also be added to your website. These are Shop Manager and Customer. In addition to this, you have the option to add custom user roles – for example with the free User Role Editor plugin.
With WooCommerce Protected Categories, you can hide categories in a way that only users with the correct user roles can access them. So, for example, if you had a user role for the distributors you work with, you could create a hidden category that they could access by logging into their account. The hidden category can contain products that you’d like to make available to your distributors only.
Now that you have a clear understanding of how the WooCommerce Protected Categories plugin works, let’s take a look at how you can use it to hide categories in your WooCommerce store.
How to hide WooCommerce categories on your online store
To hide categories in your WooCommerce store, you’ll need to install and activate the WooCommerce Protected Categories plugin on your WordPress website.
Once that’s done, here’s what you’ll need to do to set everything up and begin hiding categories in WooCommerce:
Step #1: Configure the plugin’s basic settings
Log in to your WordPress admin panel and head over to WooCommerce –> Settings –> Products -> Protected categories to configure the plugin’s settings.
If you want to hide your protected product categories from your store, untick both boxes next to the Category Visibility option. This way, the product categories – and all of the products listed under that category – will be hidden from your store. Specifically, they won’t show up on widgets, search results, and your store’s navigation menu.
In addition to this, you have the option to prefix the names of all of your hidden categories. The Prefix categories option automatically prefixes hidden categories with Protected: or Private: to make it easier to distinguish between them.
Step #2: Choose an option to hide WooCommerce categories
Head over to Products –> Categories to view your existing categories. Choose a category that you’d like to hide and click the Edit button. (Alternatively, you can create a new category to make private, as well.)
You’ll be redirected to the Edit category screen where you’ll see the Visibility section near the bottom of the page. Tick the Protected option and choose one of the following:
- Password protected. Once the user enters the correct password in a login form, they can access the hidden category. You can create multiple passwords by clicking the (+) icon. This way, different users (or user groups) will be able to access the same hidden category using their unique password.
- User roles. Users with the specified user roles will be able to access the hidden category.
- Users. Only specific, individual users that you select will be able to access the hidden category.
Click the Update (or Add new category) button at the bottom of the screen to proceed.
Step #3: Configure your login form (for password protected categories)
If you selected the Password protected option in Step #2, you’ll also want to configure your login form.
By navigating to WooCommerce –> Settings –> Products -> Protected categories, you’ll be able to:
- Set a password expiry. This lets you decide how long the password should unlock the hidden category for.
- Decide the password entry page. This option lets you decide where you want your login page to be on your online store. You can create a new page (such as Access Store).
- Configure your password entry form. You have the option to customize the login form’s heading, message, password label, login button label, and more.
By doing so, users and customers will be able to log in by going to the specified page. When a user tries to to access a hidden category using a direct link, they’ll be prompted to enter the password.
Step #4: Let users log into user and role protected categories
If you selected the User roles or Users option in Step #2, you’ll be able to decide what happens if someone without the correct user privileges tries to access a hidden category or product. This could be a logged out user or someone with a different role than the one(s) you’ve granted access to.
You have the option to display a custom page, as well. This way, you can create a page (such as a page called Login Required) with a message that lets the user know that they need to login with their account to access the hidden category.
With the WooCommerce Protected Categories plugin, you’ll be able to hide categories (and any sub-categories) in two different ways i.e. either by password protecting categories or restricting access to categories by user role or individual user login.
Let’s quickly recap the main steps you need to follow to hide categories in your online store:
- Configure the plugin’s settings.
- Choose an option to hide WooCommerce categories.
- Configure your login form (in the case of password protected categories).
- Let users log into user and role protected categories.
Do you have any questions about how to hide categories in your WooCommerce store? Let us know in the comments section below.