Woocommerce Total Item with Ajax

Woocommerce Total Item with Ajax Code Snippet
Share:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
Woocommerce Total Item with Ajax
Table Of Content:
Related Article
<div class="header-cart-count"><?php echo WC()->cart->get_cart_contents_count(); ?></div>
add_filter( 'woocommerce_add_to_cart_fragments', 'iconic_cart_count_fragments', 10, 1 );

function iconic_cart_count_fragments( $fragments ) {
    
    $fragments['div.header-cart-count'] = '<div class="header-cart-count">' . WC()->cart->get_cart_contents_count() . '</div>';
    
    return $fragments;
}

Reference : Update Custom Cart Count (or any HTML) after AJAX Add to Cart in WooCommerce

Leave a Reply

Your email address will not be published.

Related Article

Adding Meta Author
Adding Meta Author in WordPress
class active in navigation
Adding active class to active navigation with jQuery
Code snippet to add active class to active navigation menu.
Navigation Menu
Code (Function) to bring up the menu list in WordPress
COMPLETE PACKAGE OF WEBSITE DESIGN & DEVELOPMENT
Digitalizer offers website design & development services for company profiles, online shops, event organizers, educational institutions or other fields. You don't need to think about domains, web hosting / servers, DNS, email, design, development, security and other technical issues. Just prepare your website content, we do the rest.
All website design & development packages include 1 year maintenance!
Free Consultation
Back to top
cross