@xootix
Good day!
I manage to make it work by modifying the conditions based on a specific product ID’s.
Can you check the modified code below if it’s already enough or can we still improve it?
add_filter( 'woocommerce_cart_item_price', function( $price_html, $cart_item, $cart_item_key ){
if( $cart_item['product_id'] === 2286 || 5238 || 5458 ){
return '<div class="xoo-wsc-hide-price">'.$price_html.'</div>';
}
return $price_html;
}, 9999, 3 );
add_action( 'wp_footer', function(){
?>
<style type="text/css">
.xoo-wsc-hide-price-cont .xoo-wsc-price, .xoo-wsc-hide-price-cont .xoo-wsc-ptotal, .xoo-wsc-hide-price-cont .xoo-wsc-qtybox {
display: none;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function($){
function hide_zero_price(){
$('.xoo-wsc-hide-price').each(function(index, el){
$(el).parents('.xoo-wsc-sum-col').addClass('xoo-wsc-hide-price-cont');
})
}
$(document.body).on('wc_fragments_refreshed', function(){
setTimeout(hide_zero_price(), 50);
});
})
</script>
<?php
} );