woo-commerce-logo

Remove WooCommerce Styles and Scripts

I’ve recently started working with WooCommerce for a client. IMHO, it’s absolutely the most brilliant and easy-to-use shopping cart for WordPress.

However, you know me and I hate plug-ins and bloat. Here’s how to disable all the extra style-sheets and scripts WooCommerce loads througout your web site, and restricts them to just loading in your store:

Add this to your theme’s functions.php

Another way, is to remove the functions all together (thanks to WPSMITH):

6 thoughts on “Remove WooCommerce Styles and Scripts

  1. It’s fantastic, thanks, speeds up home page no end and stopped the ridiculous ajax calls.

    One question, how would one go about adding this to other pages that dont require the woocommerce bloat code?

    Thanks again

  2. OK, I think I figured out how to set it up to remove it from all pages except the woocommerce ones, thanks for your help! ….

    add_action( ‘wp_enqueue_scripts’, ‘child_manage_woocommerce_styles’, 99 );
    /**
    * Remove WooCommerce Generator tag, styles, and scripts from the homepage.
    * Tested and works with WooCommerce 2.0+
    *
    * @author Greg Rickaby
    * @since 2.0.0
    */

    function child_manage_woocommerce_styles() {

    remove_action( ‘wp_head’, array( $GLOBALS['woocommerce'], ‘generator’ ) );

    if ( ! is_woocommerce())
    if ( ! is_cart())
    if ( ! is_checkout())
    {

    wp_dequeue_style( ‘woocommerce_frontend_styles’ );
    wp_dequeue_style( ‘woocommerce_fancybox_styles’ );
    wp_dequeue_style( ‘woocommerce_chosen_styles’ );
    wp_dequeue_style( ‘woocommerce_prettyPhoto_css’ );
    wp_dequeue_script( ‘wc_price_slider’ );
    wp_dequeue_script( ‘wc-single-product’ );
    wp_dequeue_script( ‘wc-add-to-cart’ );
    wp_dequeue_script( ‘wc-cart-fragments’ );
    wp_dequeue_script( ‘wc-checkout’ );
    wp_dequeue_script( ‘wc-add-to-cart-variation’ );
    wp_dequeue_script( ‘wc-single-product’ );
    wp_dequeue_script( ‘wc-cart’ );
    wp_dequeue_script( ‘wc-chosen’ );
    wp_dequeue_script( ‘woocommerce’ );
    wp_dequeue_script( ‘prettyPhoto’ );
    wp_dequeue_script( ‘prettyPhoto-init’ );
    wp_dequeue_script( ‘jquery-blockui’ );
    wp_dequeue_script( ‘jquery-placeholder’ );
    wp_dequeue_script( ‘fancybox’ );
    wp_dequeue_script( ‘jqueryui’ );
    }}

Leave a Reply