+31 (0)85 401 8 230

Disabling WooCommerce Cart Fragments

Author

Written by Bram Koster

Last updated 2 weeks ago

What is it?

WooCommerce cart fragments is a script that uses the admin-ajax function to update the contents of the cart on each page. In most cases cart fragments will slow down your website or with a lot of visitors even cause downtime. This is because we can’t cache cart fragment requests and it will also load on pages that don’t have a cart and for visitors who have no items in the cart.

You can identify cart fragment requests when it has the following query string in the url: ?wc-ajax=get_refreshed_fragments

How to disable cart fragments?

Disable using a plugin

Use the Disable Cart Fragments plugin, you can find it in the WordPress Plugin Directory: Disable Cart Fragments

Disable using code

Add this code to your functions.php in your (child) theme:

add_action( 'wp_enqueue_scripts', 'bladewp_disable_woocommerce_cart_fragments', 11 );

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

Convinced by our platform?

Try 30 days for free. No contracts. Not happy? Money back!

Sign up now