Home › Forums › WoodMart support forum › Cart Item Count › Reply To: Cart Item Count
August 1, 2022 at 2:34 pm
#394820
Elise Noromit
Member
Hello,
Please replace the code with this one:
if ( ! function_exists( 'woodmart_cart_count') ) {
function woodmart_cart_count() {
if ( ! is_object( WC() ) || ! property_exists( WC(), 'cart' ) || ! is_object( WC()->cart ) || !
method_exists( WC()->cart, 'get_cart_contents_count' ) ) {
return;
}
$count = WC()->cart->get_cart_contents_count();
$classes = 0 == $count ? ' wd-hide' : '';
?>
<span class="wd-cart-number wd-tools-count<?php echo woodmart_get_old_classes( 'woodmart-cart-number' ) . $classes; ?>">
<?php if ( 0 != $count ) : ?>
<?php echo esc_html( $count ); ?> <span><?php echo esc_html( _n( 'item', 'items', $count, 'woodmart' ) ); ?></span>
<?php endif; ?>
</span>
<?php
}
}
If you have any questions please feel free to contact us.
Best Regards