WooCommerce shopping mini cart isn’t updated after ajax adding items

Picture of Woocoders
Woocoders
26th June 2023

They move the global enqueue support for fragments refresh
so call wp_enqueue_script( ‘wc-cart-fragments’ ); in your theme

or

Call the WC_AJAX::get_refreshed_fragments() at the end of your PHP coode responder; if it comes from an AJAX call

var fragments = response.fragments; if ( fragments ) {
jQuery.each(fragments, function(key, value) {
jQuery(key).replaceWith(value);
});
}

Share this post: