The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Disable WooCommerce Cart Fragments

Shared by Amit Dholiya · August 11, 2026 · @wp_enqueue_scripts

23 views
1 upvote
Back to Snippets

WooCommerce can use cart fragments to update the mini cart automatically. If your website doesn’t need this feature, disabling it can reduce unnecessary AJAX requests and improve page performance.

Steps

  1. Open your theme’s functions.php file.
  2. Add the code below.
  3. Save the file.
  4. Clear your website cache and test the cart.

Done — the WooCommerce cart fragments script will no longer load on the frontend.

function disable_woocommerce_cart_fragments() {
    wp_dequeue_script( 'wc-cart-fragments' );
}

add_action(
    'wp_enqueue_scripts',
    'disable_woocommerce_cart_fragments',
    100
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments