If you want to prevent some users from ordering products directly from your site, it is very important to hide the add to cart button on the product page and archive page for those specific users.
You have no option in WooCommerce to make this happen, so, in the following, we want to show you how to hide the add-to-cart button for a particular user role in the WooCommerce Role Based Pricing plugin.
Hide add to cart button for special user roles
To hide the add-to-cart button for special user roles using the WooCommerce role-based pricing plugin follow these steps:
- Go to the iThemeland -> Role Based Pricing.
- Go to the Hide price tab.
- Mark Enable Hide Price & Add to Cart button field.
- Mark Hide for Registered users then open the drop-down list of Select User Roles and choose the specific user roles from the list. All user roles that you have defined in WordPress will be automatically displayed to you in this list. So, you can add as many user roles as you need.
- Mark Hide add to cart button to prevent showing the add to cart button on the WooCommerce archive and product page. You can also set the following fields:
- Add to cart button text: To show a text instead of the Add to cart button to the specified users like “Contact us”.
- Add to cart Button link: To lead the users to a specific URL like the Contact Us page.
- Choose products or categories in the Select products and Select Categories fields, if you want to hide the add to cart button of some products or categories for a particular user role
Read More: How to hide the price or add-to-cart button on a specific product or category?
Step 6: Press Save settings to apply the rule
Example: Hide add to cart button for contributor and subscriber roles
To hide the add to cart button for Contributor and Subscriber roles, first, you need to mark Enable Hide Price & Add to Cart and Hide for registered users.
Then, you need to select Contributor and Subscriber from the list of users roles in the Select User Roles field.
Now, you can mark Hide Add to Cart button and press Save changes to prevent displaying the Add to Cart button on the product page and archive page as illustrated below:
If you set a message like Contact Us in the Add to Cart button text, your text will be replaced with the Add to Cart button for the specified user roles as shown below: