Remove add to cart on archive page
-
Hi everybody,
I try to hide add to cart button if 2 conditions (stock, and brand availability) are true whith this code. All is working, except on archive page. Why ?
function remove_addcart() { $product = get_product(); $dispo = $product->get_attribute( 'pa_disponibilite' ); if (($dispo > 1) && (($product->stock) == 0)) { remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 ); remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 ); } } add_action( 'wp', 'remove_addcart' );
The page I need help with: [log in to see the link]
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Remove add to cart on archive page’ is closed to new replies.