Written by Bram Koster
Last updated 10 months ago
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
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'); }
© BladeWP - Dedicated WordPress Hosting | 2013 - 2021 | All rights reserved
Made with ❤ in the Netherlands