Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Created November 30, 2019 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirokoweb/5cc3363ed54f47656c9fd77cdbec8fdc to your computer and use it in GitHub Desktop.
Save shirokoweb/5cc3363ed54f47656c9fd77cdbec8fdc to your computer and use it in GitHub Desktop.
WP Rocket's way
<?php
/** Disable Ajax Call from WooCommerce on front page and posts*/
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() {
if (is_front_page() || is_single() ) wp_dequeue_script('wc-cart-fragments');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment