Created
August 12, 2020 18:36
-
-
Save FreshLondon/7aa5c7ea78a16fe932761a2d9c83083b to your computer and use it in GitHub Desktop.
Only load WooCommerce scripts on shop pages/checkout/cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!is_woocommerce() && !is_cart() && !is_checkout()) { | |
remove_action('wp_enqueue_scripts', [WC_Frontend_Scripts::class, 'load_scripts']); | |
remove_action('wp_print_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5); | |
remove_action('wp_print_footer_scripts', [WC_Frontend_Scripts::class, 'localize_printed_scripts'], 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment