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 shopping 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 );
}

Editorial Staff

aThemeArt Editorial Staff prepares and cooks all the content that are published on athemeart.com. They are responsible for all type of web content including blog, social posts, videos, documentation etc.

test

Leave a Reply

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

15 − six =

This site uses Akismet to reduce spam. Learn how your comment data is processed.

NEW FREE THEME! BC IS HERE GET FREE THEME