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 – but it’s heavy! I’ll show you how to remove the cruft!

Option 1

There are a couple of ways to do this. The easiest is to remove the three primary stylesheets using a simple filter in functions.php

add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );

Option 2

If you want to disable specific stylesheets, you can use the following:

 *// Remove specific WooCommerce stylesheets.
function ww_dequeue_styles( $enqueue_styles ) {
	unset( $enqueue_styles['woocommerce-general'] );     // Remove the gloss
	unset( $enqueue_styles['woocommerce-layout'] );      // Remove the layout
	unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
	return $enqueue_styles;
add_filter( 'woocommerce_enqueue_styles', 'ww_dequeue_styles' );

Bring Your Own Styles

Then you can add your own styles, with the following:

 * Enqueue custom WooCommerce stylesheet.
function ww_enqueue_woocommerce_style() {
	wp_register_style( 'custom-woocommerce', get_template_directory_uri() . '/css/woocommerce.css' );
	if ( class_exists( 'woocommerce' ) ) {
		wp_enqueue_style( 'custom-woocommerce' );
add_action( 'wp_enqueue_scripts', 'ww_enqueue_woocommerce_style' );

Further reading:

WooCommerce has a page dedicated for style & script management. Also, take a look at the PHP Class responsible for enqueuing styles and scripts.

Comment section

22 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. Mhh all codes from your site and in the comment doesn’t work. I’ve changed the ‘ with the correct ‘. Must I change something for my template? I use superstore from woocommerce. Thanks for help.

  3. Solosails, I prefer to use the following if statement instead:

    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
  4. Been pulling my hair out trying to dequeue “wc-add-to-cart-variation” javascript. If anyone else is having this problem add the following to the function above: wp_deregister_script(‘wc-add-to-cart-variation’);

    Deregistering it will remove it completely.

  5. Hi, you really save my day man, I’m crying of joy!! With the new woocommerce update, I was having a lot of problems with ajax, but I could solved everything thanks to your post. Tks Tks Tks Tks forever !!!

  6. Since this is a pretty high-ranking article, I thought I’d add in this: Select2 as a library has effectively been abandoned, so as of WooCommerce 3.2x they added SelectWoo, which is a fork of the original Select2 with some Woo-specific stuff in there. As this is now enqueued under a different handle (but still basically throws in Select2-classed DOM elements), you might notice that if you’ve dequeued Select2 but NOT SelectWoo, then your country dropdown field might look weird. Easy solution: dequeue SelectWoo:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.