WooCommerce cart fragments can create unnecessary AJAX requests on pages where the cart is not needed. Disabling them can improve frontend performance and page speed.
add_action( 'wp_enqueue_scripts', 'disable_woocommerce_cart_fragments', 11 );
function disable_woocommerce_cart_fragments() {
if ( is_front_page() || is_home() || is_page() || is_single() ) {
wp_dequeue_script( 'wc-cart-fragments' );
}
}