How to disable or hide add to cart button from Woocommerce?

I have seen that most of the store owners got confused while removing or disable the add to cart button. Now for any shop page or product you can remove the the add 2 cart button. You just have to follow these simple steps. In woocommerce.php (located wp-content/plugins/woocommerce)

function WpBlog() {
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();
}

After the page refreshes you see that the add to cart button hides.

Also to hide add to cart button from Product pages. Put this code in functions.php

add_filter('woocommerce_is_purchasable', 'wpblog_specific_product');
function wpblog_specific_product($purchaseable_product_wpblog, $product) {
return ($product->id == specific_product_id (512) ? false : $purchaseable_product_wpblog);
}

I have use this as reference : WooCommerce Add to cart button

Is there any other way to do this ? I think that is the most simple and easiest way to hide add to cart button. Any other way to do that would be beneficial for me.

Hi,

Thanks for writing in!

That’s the correct way to do it.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.