Remove “add to cart” button if 2 conditions met
-
Hello,
I use this function to disable “add to cart” when my stock = zero AND when the product is no longer available with my supplier :
function remove_addcart() { global $post; if (is_product()) { $product = wc_get_product($post->ID); $dispo = $product->get_attribute( 'pa_disponibilite' ); if (($dispo != 1) && (($product->stock) == 0)) { add_filter( 'woocommerce_is_purchasable', '__return_false'); } } } add_action( 'wp', 'remove_addcart' );
It seems this code doesn’t alter FiboSearch (see image)
How can I manage it ?
Thanks a lot !
GerardThe page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Remove “add to cart” button if 2 conditions met’ is closed to new replies.