If you are looking for a way to restrict product purchases in WooCommerce based on user roles, then you are in the right place!
Restricting the product purchase based on user roles will help you to provide your users with a personalized experience. It’ll also help you collect the emails that you can use in email marketing. It’ll encourage the users to become members of your store.
So In today’s article, I’ll show you how to restrict product purchases in WooCommerce based on user role with the help of the WooCommerce Restriction Rules plugin. Here’s a quick sneak peek of the final results we’ll be achieving today.
On This Page
- 1 When Should You Restrict Product Purchase in WooCommerce?
- 2 How to Restrict Product Purchase in WooCommerce?
- 3 Conclusion
When Should You Restrict Product Purchase in WooCommerce?
Here are a few reasons or use cases to restrict product purchases in WooCommerce. These are not the only ones you can expand depending on your store and need.
1. Private Store
By adding product purchase restrictions, you’ll be able to sell both to regular and wholesale customers. Regular customers will be able to see and purchase the products they are allowed to and the wholesale customers will only see all or select products they are allowed to see.
Within your ordinary WooCommerce store, you can create a private wholesale store. This will allow the wholesale customers to place bulk orders through your website. You can give wholesale users the “wholesale customers” user role while still selling to your regular consumers.
This is the use case I’ll be using in today’s article.
2. Membership Website
It’ll also help you to restrict the content or products to members only. For example, You can create a wine club. Members of the club will be able to see some special products while the regular customers won’t be able to see them until they become members.
3. Age Restricted Products
If you are dealing with age-restricted products, this feature can be handy. Let’s say you’re selling alcoholic beverages and don’t want young people to see or buy them. This is when you can use this function to prevent children from viewing and purchasing alcoholic products.
How to Restrict Product Purchase in WooCommerce?
Here, I’ll show you how to set up restrictions on your WooCommerce products easily. For this tutorial, I’ll be using the WooCommerce Restriction Rules plugin to set up the product restrictions so that some products are only visible to wholesale customers.
This plugin can create more advanced restrictions for different products, pages, and posts based on different user roles. It’ll also allow you to add multiple rules.
So follow the following steps to set up restriction rules for products.
1. Install and Activate the WooCommerce Restriction Rules Plugin
Note: You can skip this step if you have already installed and activated the WooCommerce Restriction Rules plugin.
To install the WooCommerce Restriction Rules plugin, you will need to install the Woosuite Core plugin and activate it with the help of a license key. We have created a Quick Start Guide for you to figure out how to install and activate the WooCommerce Restriction Rules plugin.
Once you have installed and activated the plugin, now navigate to the Woosuite » Restriction Rules from your WordPress dashboard.
Now we need to add the restrictions to some of the products so that they’ll only be visible to the wholesale customers.
To do so, expand the Hide Product Rules tab by clicking on the (▾), from the settings of the plugin.
In this tab, you’ll see a few options that will help you to add restrictions to the products.
4. Hide Products from Regular Customers
Now we’ll be creating a rule that will hide some products in the selected category from all the users except the users with the “wholesale customers” role.
Select the users from the “Applies To” dropdown to create a rule. You’ll get four options:
- Specific Roles
- Specific Users
I have selected the “Specific Roles”. Once you select it, you’ll see the “Roles” field from which you can select the different user roles.
As we want to hide some products from all the users except the Wholesale Customers. So we need to select all the user roles except the “wholesale customer” role.
4.1. Select Filter By Category
Now from the “Filter By” field, select the “Category” you want to hide from all the users except the wholesale customers. You can filter products by:
Once you select any filter, you’ll see a new field below it.
As I have selected the “Category” filter so I can see the field from where I can select the product categories.
I have selected one category that I only want to be visible to the wholesale customers. You can also select multiple categories.
5. Save the Changes
Once you have created the rule, click on the “Save Changes” button at the top right corner to save all the settings.
6. Final Results
Now let’s test the rule.
To test it, I visited the site as a regular customer, and I was only able to see the products other than the makeup category.
And now, when I logged in as a wholesale customer, I was able to see the “Makeup” category too.
So that’s it, this is how you can set the product purchase restrictions in WooCommerce.
This way, you can run a private wholesale store where wholesale customers will see some extra products. You can use the Dynamic Pricing Rules Plugin to offer discounts to wholesale customers that will encourage them to buy more.
Also, if you have any queries, you can ask them in the comments or contact our customer support. Our dedicated customer support team typically replies within 48 hours.
Ready to get started? Download the WooCommerce Restriction Rules plugin today!