Hello,
How can I remove “0” on the cart icon when there’s no item in shopping cart? I would like to show the item numbers only when user adds items to the cart.
i found this https://xtemos.com/forums/topic/hide-0-in-empty-cart/
But it not working on ajax add to cart, refresh.
I need to show number when it is not “0” and hide number badges when it is “0” but to work with ajax refresh cart.
function woodmart_cart_count() {
if ( ! is_object( WC() ) || ! property_exists( WC(), ‘cart’ ) || ! is_object( WC()->cart ) || !
method_exists( WC()->cart, ‘get_cart_contents_count’ ) || WC()->cart->cart_contents_count == 0 ) {
return;
}
$count = WC()->cart->get_cart_contents_count();
?>
<span class=”wd-cart-number wd-tools-count<?php echo woodmart_get_old_classes( ‘ woodmart-cart-number’ ); ?>”><?php echo esc_html( $count ); ?> <span><?php echo esc_html( _n( ‘item’, ‘items’, $count, ‘woodmart’ ) ); ?></span></span>
<?php
}
https://xtemos.com/forums/topic/hide-0-in-empty-cart/#post-15322
something like thos for woodmart?