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.

  • Go to the WordPress dashboard and install the FTP File Manager 
  • Then open the wp-content –> plugins —> woocommerce folder
  • Then open the woocommerce.php file in a text editor like notpad++ or sublime.
  • Now paste the following lines inside the 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'); 
  • After adding those lines the function becomes like this
 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!

2 thoughts on “Remove, Disable, or Hide WordPress Add to cart Button in woocommerce plugin”

  1. Hi, I just looked at your website and really impressed by it’s design and content. You are doing an excellent job by providing such information to the world. Thank you so much.

    Reply

Leave a Comment