W3Raja

Remove, Disable, or Hide WordPress Add to cart Button in woocommerce plugin

Hi, welcome to w3raja.com. Today I am going to teach some simple method/trick to disable the WordPress add to cart button. Actually, there are a lot of ways to disable the add to cart button from your WordPress product or shop page.

Where do I disable Add to cart button from WordPress or woocommere?

WordPress is the cms (content management system) which helps you to create pages, posts, and images. you can manage your pages/posts from wordpress dashboard without the coding knowledge.

Woocommerce is the plugin created for wordpress. In similar woocommerce is an additional plugin which converts your blogging wordpress website into an e-commerce platform.

How to disable the ADD TO CART button from woocommerce based WordPress sites?

Don’t try to disable the “add to cart” button by using additional css method. If you disable the plugin with display:none; in your customize page it will slow down the site.

 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'); 
 function wc() {

  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');

  return WooCommerce::instance();
}

Now your code looks like the below screenshot

Remove WordPress Add to cart Button
Remove WordPress Add to cart Button

Now save the file, the “Add to cart button” is successfully removed by adding just two lines of code.

Please ask your doubts in the comment section and I will reply to your doubts. Happy Coding!

Exit mobile version