adapazarı escort sakarya escort akyazı escort anal escort arifiye escort erenler escort ferizli escort geyve escort hendek escort karasu escort pamukova escort sapanca escort serdivan escort söğütlü escort taraklı escort sakarya escort sakarya escort
serdivan escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort ankara travesti webmaster forum hd porn nevşehir escort
ankara escort bayan ankara escort bayan ankara escort
Ajaxify header cart items count in Woocommerce Archives - Wpdevcodes
sakarya escort sakarya escort sakarya escort bayan sakarya escort bayan serdivan escort kayseri escort webmaster forum

Tag Archives: Ajaxify header cart items count in Woocommerce

Woocommerce add to cart count can allow to display in the Header section. In this article we can know how to display the cart count in the header. Here is the code, add the below code in the function.php file.

<?php 
add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
function woocommerce_header_add_to_cart_fragment( $fragments ) {
	global $woocommerce; ob_start(); ?>
	<a class="cart" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo $woocommerce->cart->cart_contents_count; ?></a>
	<?php $fragments['a.cart'] = ob_get_clean(); return $fragments; } ?>
	<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>">
	<?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>