Woocommerce Update Cart Ajax Hook Code Example


Example: woocommerce update mini cart ajax

add_filter( 'woocommerce_add_to_cart_fragments', function($fragments) {      ob_start();     ?>      <div class="cart-contents">         <?php echo WC()->cart->get_cart_contents_count(); ?>     </div>      <?php $fragments['div.cart-contents'] = ob_get_clean();      return $fragments;  } );  add_filter( 'woocommerce_add_to_cart_fragments', function($fragments) {      ob_start();     ?>      <div class="header-quickcart">         <?php woocommerce_mini_cart(); ?>     </div>      <?php $fragments['div.header-quickcart'] = ob_get_clean();      return $fragments;  } );

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable