Last Updated: February 21, 2018
·
207
· alexanderbiscajin

How to Hide or Remove Add to Cart Button In WooCommerce Store


There are two ways to hide add to cart button.
1. Removing add to cart button from product pages
2. Removing add to cart button for specific products

To remove add to cart button from product pages put the code in
woocommerce.php

function WpBlog() {
removeaction( ‘woocommerceaftershoploopitem’, ‘woocommercetemplateloopaddtocart’);
removeaction( ‘woocommercesingleproductsummary’, ‘woocommercetemplatesingleaddto_cart’);
return WooCommerce::instance();
}

To remove add to cart button for specific products use this code in functions.php

addfilter(‘woocommerceispurchasable’, ‘wpblogspecificproduct’);
function wpblog
specificproduct($purchaseableproductwpblog, $product) {
return ($product->id == specific
productid (512) ? false : $purchaseableproduct_wpblog);
}

Reference: https://www.wpblog.com/add-to-cart-button-in-woocommerce-store/