Hello,
I added this code to my functions.php of the Child Theme.
I added it to this hook woocommerce_add_to_cart
but when I add products to the cart it loads forever till I refresh the page.
My Code:
// Changing Header cart-number to show when count > 0
function woodmart_cart_count() {
$count = WC()->cart->get_cart_contents_count();
if($count) { ?>
<span class="woodmart-cart-number"><?php echo esc_html($count); ?> <span><?php echo esc_html( _n( 'item', 'items', $count, 'woodmart' ) ); ?></span></span>
<?php }
}
// add_action('woocommerce_add_to_cart', 'woodmart_cart_count');
// add_action('woocommerce_add_to_cart', 'woodmart_cart_count',10);
Kind Regards,
Harry