Table of Content

HomeBlogPlugin UsageHow to hide the add-to-cart bu...

How to hide the add-to-cart button for special user roles?

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:

  1. Go to the iThemeland -> Role Based Pricing.
  2. Go to the Hide price tab.
  3. Mark Enable Hide Price & Add to Cart button field.
  4. 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.
  5. 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.
  6. 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 

Woo role-based pricing plugin hide price for particular user role

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.

Hide price and add-to-cart btn for specific user roles

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:

Result of hiding add-to-cart btn in role-based pricing plugin

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:

Show custom text on hide price and ann-to-cart btn rule using woo role-based pricing plugin
Like this tutorial?

Do you still have a problem?

If you still have unanswered questions or need custom work for your plugin, contact iThemeland Support.

Comments

Comments are closed.