Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
Created November 30, 2019 18:58
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/5e20bca055033059f97fd34ab73aa672 to your computer and use it in GitHub Desktop.
Save shirokoweb/5e20bca055033059f97fd34ab73aa672 to your computer and use it in GitHub Desktop.
WordPress shutdown hook to disable WooCommerce get_refreshed_fragments
<?php
/** Disable Ajax Call from WooCommerce on front page, posts, categories, and tags*/
add_action( 'shutdown', 'dequeue_woocommerce_cart_fragments');
function dequeue_woocommerce_cart_fragments() {
if (is_front_page() || is_single() || is_category() || is_tag() ) wp_dequeue_script('wc-cart-fragments');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment