Function to hide add to basket on some
-
Hi,
if anyone can tell me why this code won’t work or any issues you can see with it i would appreciate it.
I am trying to hide the add to basket on most gloves except some (array)
the code gives me a white screen of deathfunction remove_product_description_add_cart_button(){ $product = wc_get_product(); $id = $product->get_id(); $hide_for_products = array(76928, 76925); $category = 'gloves'; //Remove Add to Cart button from product description of product if(!in_array( $product->get_id(), $hide_for_products ) && has_term( $category, 'product_cat', $id )) remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); } add_action('wp','remove_product_description_add_cart_button');
- The topic ‘Function to hide add to basket on some’ is closed to new replies.