woocommerce cart count button code example
Example 1: how to add woocommerce cart counter
add_filter( 'woocommerce_add_to_cart_fragments', 'misha_add_to_cart_fragment' );
function misha_add_to_cart_fragment( $fragments ) {
global $woocommerce;
$fragments['.misha-cart'] = 'Cart (' . $woocommerce->cart->cart_contents_count . ')';
return $fragments;
}
Example 2: how to add woocommerce cart counter
Cart (cart->cart_contents_count ?>)