How to redirect users to a protected WooCommerce category after they login
Lots of people use the WooCommerce Protected Categories plugin to sell hidden products to specific logged in users or roles. Whether you’re selling user-specific products or creating a hidden wholesale area for users with a specific role, this article will tell you how to allow your customers to login and access their hidden category.
The exact method depends on which method you’re using to protect your categories.
Password protected categories
If you’re using password protected categories, then you can create a central category login page. Each customer will enter the password for their category on the central login page, and the plugin will redirect them to the category page matching their password.
Role and user protected categories
If you’ve protected your categories by restricting them to specific roles or users, then you may want to redirect them to their hidden category page after they login. This is not part of our plugin, but we have provided some useful guidance below.
To unlock a hidden category, the customer need to log into their individual user account on your website. The easiest way to do this is to use the WooCommerce Account page, which functions as a front end login page for logged out users.
Once the customer has logged into their account, they need to be redirected to the correct category page. We recommend the free Peter’s Login Redirect plugin for this. You can set it up as follows:
- Install and activate the plugin on your WordPress site (Plugins → Add New).
- Go to Settings → Login/logout redirects.
- On the ‘Manage redirect rules page’, you will see sections on the page for Specific Users and Specific Roles. Use these to select a user and/or role, and add the URL of their category page.
- Repeat step 3 for each of your users who have their own categories.
- Scroll to the bottom of the page and click ‘Update’.