Remove Add to Cart Buttons from WooCommerce

A lot of people are using WooCommerce to build their online shop nowadays but I’m sure not all of them are really using the add to cart functionality in woocommerce.

If you are one of them and are are curious how to disable or remove the Add to Cart button from WooCommerce products, we’re going to provide you with a little snippets.

As always, add this code to your theme’s functions.php file.

// Remove shoopping cart
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );

If you want to disable the Add to Cart button only for non-admin users, you use this instead:

// Remove shoopping cart for non-admin users / normal site visitors
if ( ! current_user_can( 'administrator' ) ) {
 remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}

Inspire us with your love!

Facebook Twitter Pinterest Reddit

aThemeArt editorial staff provides and makes all the content that is published on athemeart.com. In addition, they are responsible for all web content types, including blogs, social posts, videos, documentation, etc.

You can check also

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*