How to Restrict WooCommerce Products By User Roles [Step By Step]

In this article, I will show you how to restrict particular user roles from viewing the products. This guide will help you achieve the desired results in the least steps. Also, we are going to use WordPress plugins to add this feature. 

So, continue reading ahead and figure out how to hide WooCommerce products from specific user roles.

What Are Restricted Products?

Restricted products are also known as hidden products. In simple terms, restricted products are products that all visitors can’t access. It means users can’t view and buy the products if they don’t have permission. They can’t even view the product description. 

The product would only be visible to some users that are permitted to view it. As an eCommerce store owner, you have got the right to choose it. You can select who can view the product and who can’t. 

Now, we understand the meaning of restricted products. A quick recap, restricted products are products that are only visible to selected visitors. 

Are you confused about when you should hide products from specific users? Read the next section to check this out. 

When Should You Hide Products From Specific Users?

Are you confused about when you should hide products from specific users? Read this section to clear out all your doubts. 

When you wish to add this feature to your WooCommerce store, there could be multiple use cases. If you plan to use this feature, you might already know the reason. Still, I’m mentioning some use-cases here.

Here are some reasons you will need to hide products from specific user roles. 

Dealing With Age Restricted Products: If you deal with age-restricted products, then this feature might be helpful for you. Let’s say you are selling Alcoholic products and don’t want younger visitors to view and buy those products. That’s when you can use this feature to restrict younger visitors from viewing and purchasing those alcoholic products. 

Selling Personalized Products: Another use case could be when you are dealing with personalized products. For instance, you have created products only for specific user groups. And, you don’t want other users to see those products. In this case, this feature would be helpful for you and your store. 

Client Specific Products: This feature would be helpful when working with different client types like retailers, wholesalers, and more. Now, you want users to see their respective products only. E.g., wholesale users can only view wholesale products, and retail customers can only view retail products. This is the perfect example of this use case.

Member Only Or Community Website: This feature would be most helpful for members only and community websites. Suppose you run a community website and create unique products for your community members. Then, you can use this feature to restrict specific users from accessing those products. With the help of this, only your community members will be able to view and buy those unique products. 

These are some circumstances when you can, or you might need this feature on your WooCommerce store. You can think of implementing this feature. 

We must first figure out how to create user roles in WordPress to restrict certain user groups. 

How to Create User Roles In WordPress?

WordPress allows us to create multiple and varied user roles according to our requirements. By default, you will find some predefined user roles in WordPress. You will find roles like Wholesale, Customers, Subscribers, and a few more. You can choose from them or create new ones as per your needs.

To create WordPress user roles, we will need the User Registration plugin by Woosuite. This plugin will help us develop new roles for our WooCommerce store. If you want to do this manually for each user, you don’t need this plugin then. Follow the given steps to create a new user role.

So, I will start from scratch by installing the Woosuite Core plugin to create new user roles. After that, we will find out how to restrict WooCommerce products by user roles. 

Step 1. Install and Activate The WooSuite Core Plugin

We will first install and activate the Woosuite Core plugin. After installing the plugin, it will automatically enable the User Registration plugin. To install the plugin, make sure you have downloaded the plugin to your computer. Follow the given steps:

  1. Go to the Plugin’s section, and click on Add New.
  2. Click on Upload Plugin.
  3. Choose the plugin file, and click on Upload.
  4. After uploading the plugin, click on Install Plugin.

Now, it will start installing the plugin. When it is done installing the plugin, it will notify you via a prompt text on the screen. You will find the plugin in the WordPress dashboard’s Plugin section. Here is the summarized process.

WordPress Dashboard: Plugins > Add New > Upload Plugin > Choose File > Install Now

Now, we will Activate the Woosuite Core plugin. To Activate the plugin, visit the Plugin’s section, and look for the Woosuite Core. Then, click on the Activate button, and wait till it activates. 

WordPress Dashboard: Plugins > Woosuite Core > Activate

No, we will activate the Woosuite Core License. Follow the next step. 

Step 2. Activate The Licence 

After installing and activating the Woosuite Core plugin, you will see a new option in the WordPress tool menu. The new option would be Woosuite. 

In the Woosuite sub-menu, you will see some new options. From those options, click on the Activate button. After clicking on that, it will redirect you to a new page. 

The new page will ask you to add the license key in the given area. So, paste the license key in the given box and click on Activate License. 

Woosuite > Activate > Paste Licence > Activate Licence

Note: You would have received your license key via email. In addition, you can also find the license key in your Woosuite Account. Log into your Woosuite account and look for the license key. 

After activating the Woosuite Core license, it will enable the User Registration plugin by Woosuite automatically.

Step 3. Install the User Registration Plugin By Woosuite

We have now installed and activated the Woosuite Core plugin. Besides, we have also activated the Woosuite license. After activating the plugin, you will get a new option called Woosuite in the WordPress tool menu. In this step, we will now install the User Registration plugin.

Click on the Addons option under the Woosuite sub-menu. 

In the Addons section, look for the User Registration plugin. We will need to turn it on. So, click on the toggle to install it. 

WordPress Dashboard: Woosuite > Addons > User Registration for WooCommerce > Install Now

Step 4. Create New User Roles

We will now create new user roles. By default, you will find some predefined user roles like Subscriber, Admin, Editor, etc. You can also use the pre-existing roles if you want.  

These user roles are required to restrict the visitors from viewing the product. Follow the given steps now.

Search for the User Registration under the Woosuite submenu. Click on the User Registration tab. There you will discover some settings like General, User Roles, Approve New Users, and more. First, you have to click on User Role. 

After that, enable the Enable User Role selection by clicking on it. 

Click on the Add New User Role option, and start creating new user roles. You will get some options, and we will need to configure them one by one. 

4.1 Role: In the Role field, enter the name you want to give to your user role. I want to create a Wholesale role, so I’m entering Wholesale. Also, the role name should be in lowercase with hyphens.

4.2 Display Name: In this field, enter the name you want to display on the front end. Yet, this won’t be visible on the front end. I’ll name it Wholesale.

4.3 Copy From: This setting specifies the abilities you want to offer to this new user role. I’m selecting Customer. After selecting Customer, they could shop freely without any limitations. If I copy it from the Administrator, it means users will be able to make changes in the store.

After making changes, click on the Add Role button. Now, we have created a new role. You can create unlimited roles as per your Woostore requirements. 

So, now we have finally figured out how to create new user roles in WordPress. Read the next heading to know how you can hide products from specific user roles. 

.

How to Restrict WooCommerce Products By User Roles?

WordPress doesn’t offer excellent functionality to hide products from particular user roles. It only lets you protect products with a password. However, this option isn’t suitable for the long term for WooCommerce store owners. But, you don’t need to worry about that. We can still add this feature to our Woostore with WordPress plugins. 

For this tutorial, I will use the Restriction Rules plugin by Woosuite

First, we will install and activate the WooSuite Core plugin. Now, follow all the steps correctly to achieve the desired results. 

1. Install and Activate the Woosuite Core Plugin

We will need to install and activate the Woosuite Core plugin. After that, it will automatically enable the Restriction Rules plugin. To install the plugin, make sure you have downloaded the plugin to your computer. Follow the given steps:

  1. Go to the Plugin’s section, and click on Add New.
  2. Click on Upload Plugin.
  3. Choose the plugin file, and click on Upload.
  4. After uploading the plugin, click on Install Plugin.

2. Activate The Licence 

This is the same process outlined above

Navigate to Woosuite > Activate > Paste Licence > Activate Licence

3. Install the Restriction Rules Plugin

We have now installed and activated the Woosuite Core plugin and license. After activating the plugin, you will get a new option called Woosuite in the WordPress tool menu. In this step, we will now install the Restriction Rules plugin. 

Click on the Addons option under the Woosuite sub-menu. In the Addons section, look for the Restriction Rules plugin for WooCommerce. And click on the toggle to install it. 

WordPress Dashboard: Woosuite > Addons > Restriction Rules plugin > Install Now

4. Restrict Products For Some User Roles

Head over to the Addon section in the Woosuite submenu, and search for the Restriction Rules plugin. After that, click on the Restriction Rules option. 

It will redirect you to a new page that will contain some settings. On the new page, you will see four different sections: Hide Website/Force Login, Hide Product Rules, Password Protected Rules, and Password Settings.  

Each section will include different options. To restrict or hide the products, we will need to tweak these settings. Follow the given step carefully. To be extra sure, you can cross-check the setting with the image attached in each step.

4.1 Hide Product Rules

From this setting, you can hide products from specific users. We will now start creating new rules and exclude users from accessing the products. This plugin lets you choose which category or particular product will be hidden for specific users or user groups. Else, they will be able to browse other products and categories. 

4.2 Apply To: Select the user roles on which you want to apply this rule. You can choose from Everyone, Guests, Specific Users, and Specific Roles. As we are talking about some roles only, I will select Specific Roles. After choosing the Specific Roles option, you must select from the roles created on your websites. I’m currently setting it to Wholesale. You can choose as necessary.

4.3 Filter By: Select the products you don’t want restricted users to view and buy in this setting. So, filter out the products on which you want to apply this rule. You can choose from Categories, Tags, and Products. After selecting any given options, you have to select the same category, tags, or product. 

For instance, if I select the category T-shirts, it means Wholesale users won’t be able to buy products from that particular category. In addition, you can select more than one option. It means you can have more than one category, product, or tag from the given list. 

So, choose accordingly as per your store requirements. After selecting them, click on Add New Rule. You can create multiple rules for different roles and powers. 

4.4 Save changes

Password Protected Rules by User Role (Optional)

If you want to set a password on a certain category or product, you can use this feature to do that.

Applies To: Select the user roles on which you want to apply this rule. You can choose from Everyone, Guests, and Specific Users. As we are talking about specific roles, I’m going to select Specific Roles. After choosing Specific Roles, you have to select from the roles just created with the help of the previous section. I’m currently setting it to Wholesale. It means Wholesale users will need to enter the password to view that particular product. You can choose accordingly.

Note: Guests are those who haven’t created an account with your online store.

Filter By: From this setting, pick the products on which you want to apply the rule. It offers three options – Categories, Tags, and Products. After selecting any given options, you have to select the exact category, tags, or product. 

For instance, if I select the category T-shirts, it means Wholesale users won’t be able to buy products from that particular category. In addition, you can select more than one option. It means you can have more than one category, product, or tag from the given list. 

Password: In this field, you will need to enter the password you want to set for the selected ones. I’ll advise you to add a strong password – a combination of alphabets, numbers, and symbols. 

Password Expiry Date: You can use this feature to set an expiry date on your password. If you set the expiry date, the password will stop working after a certain period. 

Password Setting

Password Entry Form: If you have enabled the Password feature, you can use this feature. Otherwise, it is not important. You can leave this field blank or write something like ‘Enter the Correct Password’ or anything of your choice. 

Submit Button Text: This text would be visible on the Submit button. You can write Submit in the given field. 

After making all the required changes click on the Add New Rule button. Later on, click the Save Changes button to save the settings. Now, we have made all the changes perfectly. Before heading towards it, I’ll advise you to check the settings once again. 

Final Results

We have made all the required changes, and now it’s time to check whether it’s working correctly or not. 

I am currently at the Shop page of my Demo Site and signed up as a Wholesale user account. I selected the Closed Frame Art product to hide from Wholesale. Here you can see the product I chose to hide is not visible on the Product page. In the end, our feature is working properly. 

Conclusion

Finally, we figured out how to restrict WooCommerce products by user roles. We checked out how you can limit users from buying the products. So, this was all about how you can restrict products by roles. I hope you understand all the steps carefully and implement this in your WooCommerce store. This is the step-by-step guide on how to restrict WooCommerce products by user roles.

Brian
Brian

Welcome to the AovUp blog, where we discuss all things WooCommerce. I hope we can help you achieve something today...

Leave a Reply

Your email address will not be published. Required fields are marked *

Unlock Your

25% Discount

Coupon Code: FESTIVE25

We – and our partners – use cookies to deliver our services and to show you ads. By using our website, you agree to the use of cookies as described in our Cookie Policy