WooCommerce – Display Price and Add to Cart button for specific user role only on Shop and Single Product pages

There are times when you want to display your products as catalog only and allow visitors to buy products only when they are logged in (after registration).

In such case you want to display products with basic information like an image, short description, SKU etc. without displaying product price and giving ability to purchase the items.

This tutorial provides you the code snippet to exactly do that. Below snippet that goes to functions.php file of your child theme, will display “Add to Cart” button and “Price” on Single Product page as well as on Shop and Category pages, only if user role is either Admin OR Customer. Feel free to experiment with the code by changing the user role that suits your application.

1 thought on “WooCommerce – Display Price and Add to Cart button for specific user role only on Shop and Single Product pages”

Leave a Reply

Your email address will not be published.