CODE CODIFY.CLUB

Hide or Disable the Add to Cart Button

Hide or Disable the Add to Cart Button

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

Remove Add to Cart Button for Specific Products

add_filter(‘woocommerce_is_purchasable’, ‘my_woocommerce_is_purchasable’, 10, 2);
function my_woocommerce_is_purchasable($is_purchasable, $product) {
return ($product->id == whatever_random_id_you_want ? false : $is_purchasable);
}

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed