Answers for "add to cart count 1 woocommerce"

PHP
0

how to add woocommerce cart counter

<a href="<?php echo wc_get_cart_url() ?>" class="misha-cart">Cart (<?php echo $woocommerce->cart->cart_contents_count ?>)</a>
Posted by: Guest on December-07-2020
0

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'] = '<a href="' . wc_get_cart_url() . '" class="misha-cart">Cart (' . $woocommerce->cart->cart_contents_count . ')</a>';
 	return $fragments;
 
 }
Posted by: Guest on December-07-2020

Code answers related to "add to cart count 1 woocommerce"

Browse Popular Code Answers by Language