Skip to content

Instantly share code, notes, and snippets.

@mrkdevelopment
Created June 17, 2017 14:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkdevelopment/d3bcb7476f4c4c688f810ab40f33a175 to your computer and use it in GitHub Desktop.
Save mrkdevelopment/d3bcb7476f4c4c688f810ab40f33a175 to your computer and use it in GitHub Desktop.
Disabled WooCommerce Cart Fragments on your homepage
/** Disable Ajax Call from WooCommerce */
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() { if (is_front_page()) wp_dequeue_script('wc-cart-fragments'); }
@mrkdevelopment
Copy link
Author

This script can be added to your WordPress functions.php in your child theme to stop cart fragments being loaded on your homepage or any specific landing page.

This reduces load time by up to .5 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment