1<?php
2//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
3
4/**
5 * Manage WooCommerce styles and scripts.
6 */
7function grd_woocommerce_script_cleaner() {
8
9 // Remove the generator tag
10 remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
11
12 // Unless we're in the store, remove all the cruft!
13 if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
14 wp_dequeue_style( 'woocommerce_frontend_styles' );
15 wp_dequeue_style( 'woocommerce-general');
16 wp_dequeue_style( 'woocommerce-layout' );
17 wp_dequeue_style( 'woocommerce-smallscreen' );
18 wp_dequeue_style( 'woocommerce_fancybox_styles' );
19 wp_dequeue_style( 'woocommerce_chosen_styles' );
20 wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
21 wp_dequeue_script( 'selectWoo' );
22 wp_deregister_script( 'selectWoo' );
23 wp_dequeue_script( 'wc-add-payment-method' );
24 wp_dequeue_script( 'wc-lost-password' );
25 wp_dequeue_script( 'wc_price_slider' );
26 wp_dequeue_script( 'wc-single-product' );
27 wp_dequeue_script( 'wc-add-to-cart' );
28 wp_dequeue_script( 'wc-cart-fragments' );
29 wp_dequeue_script( 'wc-credit-card-form' );
30 wp_dequeue_script( 'wc-checkout' );
31 wp_dequeue_script( 'wc-add-to-cart-variation' );
32 wp_dequeue_script( 'wc-single-product' );
33 wp_dequeue_script( 'wc-cart' );
34 wp_dequeue_script( 'wc-chosen' );
35 wp_dequeue_script( 'woocommerce' );
36 wp_dequeue_script( 'prettyPhoto' );
37 wp_dequeue_script( 'prettyPhoto-init' );
38 wp_dequeue_script( 'jquery-blockui' );
39 wp_dequeue_script( 'jquery-placeholder' );
40 wp_dequeue_script( 'jquery-payment' );
41 wp_dequeue_script( 'fancybox' );
42 wp_dequeue_script( 'jqueryui' );
43 }
44}
45add_action( 'wp_enqueue_scripts', 'grd_woocommerce_script_cleaner', 99 );