mendoadmin
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Side Cart Woocommerce | Woocommerce Cart] Hide ZERO price in the side cartGood 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 } );
Forum: Plugins
In reply to: [Side Cart Woocommerce | Woocommerce Cart] Hide ZERO price in the side cartHi @xootix
Yes, you will not find the zero price directly in our live site product-page because the zero-priced product is an appointment.
What you can do is, add to cart (save and proceed) any product (e.g this in this URL) then an appointment will pop-out when the page loads in the cart page.
I tried your code above but it did not change anything in the front-end.
Here is a screenshot for your reference with zero-priced product
Viewing 2 replies - 1 through 2 (of 2 total)