1. Home
  2. Knowledge Base
  3. WooCommerce Protected Categories
  4. Advanced Usage

How to sell access to a protected WooCommerce category

Our WooCommerce Protected Categories plugin lets you lock down specific product categories so that only authorized users can access and buy them. Most of our customers manually give their users the logins to their protected categories. This article will tell you how to automate this process.

You'll learn how to sell access to protected WooCommerce categories and automatically give purchasers their logins for the hidden content. For example, you might want to do this if you are creating a WordPress membership site where people can buy access to a members-only shop containing exclusive products.

The following instructions assume that you have already set up the free WooCommerce plugin on your WordPress site.

Step 1 - Create a new user role

Create a dedicated user role with the free User Role Editor plugin. Do this by cloning the 'Customer' role that comes with WooCommerce itself.

For example, if you are selling access to a hidden members shop then you might create a new role called 'Members'.

Step 2 - Create a hidden area on your website

Use WooCommerce Protected Categories to create a category containing the products that will be hidden from public view. Protect this category by restricting it to the user role that you created in Step 1.

To create more complex members-only shops, add multiple categories and restrict them all so that only logged in users with the correct role can see them.

Step 3 - Create a product that gives access to the hidden area

Next, create a product which people will purchase to gain access to the hidden category you created in Step 2. DO NOT put this product in a protected category, as it should be available for anyone to view.

Step 4 - Give access to people who purchase the product

In the main WooCommerce settings (WooCommerce → Settings), you should disable guest checkout. If you do this, then WooCommerce will automatically create a user account for everyone who makes a purchase. WordPress will also send them their login details so they can access the hidden area.

Use YITH's Automatic Role Changer plugin to automatically change the role of everyone who purchases the product you created in Step 3. Set it up to automatically change the role from 'Customer' to 'Member' (or whatever you chose to call the new role), thus giving them access to the hidden category.

Step 5 (optional) - Create an email for everyone who buys the membership product

As you saw in Step 4, WordPress will email each customer their login details so that they can access the hidden members-only store. However, this email will be fairly basic and may not be as professional as you would like.

Instead, you can use the Follow-Ups plugin to create a custom email that is sent to everyone who buys the product you created in Step 3. This should contain useful information such as how to access the hidden area of your WooCommerce store.

Once someone has purchased access to the hidden area of your store, you need to make it easy for them to find it.

You can easily do this by going to Appearance → Menus and adding links to your protected categories to your website menu. WooCommerce Protected Categories will only show these links to logged in users with access to these categories. The links will be hidden from everyone else.

Note: To use this feature, you must untick the 'Show protected categories & their products in navigation menus' box on the WooCommerce Protected Categories plugin settings page.

Can I expire people's access to the hidden area?

Yes, you can do this by using the free Expire Users plugin to automatically expire people's user logins - and therefore revoke their access to the protected category - after a specific period has elapsed.

How can I sell access to a different type of hidden area rather than products?

These instructions are about how to sell access to a hidden category of WooCommerce products. If you prefer, you can sell access to other types of information with our other plugin - Password Protected Categories. This lets you create a hidden area containing other types of WordPress content, such as posts, pages, or any custom post type.

Please see our separate article on how to sell access to hidden areas created using Password Protected Categories.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.