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.
Continue reading →

WooCommerce Redirect Add to Cart button or Product Image link to Checkout page on Shop/Category Pages for Simple

When add to cart button is clicked Woocommerce by default redirect users Cart page. When Product image is clicked it goes to product details page. But if you want to redirect user to checkout page whenever visitor clicks on add to cart button or product image link, this tutorial will help you to achieve it.

In order to implement this feature follow these 3 steps.

Step 1: Product Display Options
Go to WooCommerce -> Settings -> Products -> Display Screen.
As indicated in the below screenshot, set “Add to Cart behaviour” to “Redirect to the Cart Page after successfully addition.
Continue reading →