If you want to hide the Add to Compare button for specific products you can use the following filter hook:
add_filter( 'woocommerce_better_compare_show_add_to_compare_button' ,'hide_compare_btn', 10, 2); function hide_compare_btn( $show, $product ){ if($product->get_id() == 123) { $show = false; } return $show; }
this code should be put to where please?
Into your child theme functions.php for example
I wanted somehow to disable product comparison on some pages, because a woocommerce catalog and we created some product pages where we want to buy the products, but as it is the page when selecting only products it doesn’t work, so I need to release it for the entire site.
Is there any way?
how do i hide compare button on all products/pages