CHECKING STATUS
I AM LISTENING TO
|

Speed up WordPress / WooCommerce on none commerce pages

19. September 2015
.SHARE

Table of Contents

WooCommerce provides great functionality, but loads a lot of resources even if not needed.

If a site loads longer than 5-7 seconds, potential customers already loose interest :)

UNLOAD ALL THAT IS NOT NEEDED

Add this to your functions.php:

add_action( 'wp_enqueue_scripts', 'cleanup_woocommerce_includes', 99 );

function cleanup_woocommerce_includes(){
 //check that woo exists
 if ( function_exists( 'is_woocommerce' ) ) {
  if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {}
  /*Styles*/
  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_style( 'woocommerce-layout' );
  wp_dequeue_style( 'woocommerce-smallscreen' );
  wp_dequeue_style( 'woocommerce-general' );
  wp_dequeue_style( 'wc-bto-styles' ); 		
  
  
  /*Scripts*/
  wp_dequeue_script( 'wc-cart' );
  wp_dequeue_script( 'wc-cart-fragments' );
  wp_deregister_script( 'wc-add-to-cart' );
  wp_dequeue_script( 'wc-add-to-cart' );
  wp_deregister_script( 'wc-add-to-cart-variation' );
  wp_dequeue_script( 'wc-add-to-cart-variation' );
  wp_dequeue_script( 'wc-checkout' );
  
  wp_dequeue_script( 'wc-single-product' );
  wp_dequeue_script( 'jquery-blockui' );
  wp_dequeue_script( 'wc_price_slider' );		
  
  wp_dequeue_script( 'wc-chosen' );
  wp_dequeue_script( 'woocommerce' );
  wp_dequeue_script( 'prettyPhoto' );
  wp_dequeue_script( 'prettyPhoto-init' );		
  wp_dequeue_script( 'jquery-placeholder' );
  wp_dequeue_script( 'fancybox' );
  wp_dequeue_script( 'jqueryui' );

  }
 }
}

Like always, make sure that nothing breaks. If things break or are required by certain pages add an exception for that!

Check WordPress Condional Tags.

Sources:

  1. How to Load WooCommerce Scripts and Styles Conditionally to Improve Page Load Speed
  2. Only load WooCommerce scripts on shop pages and checkout + cart

REMOVE GENERATOR META TAG

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

Enjoy coding …

Let’s Talk!

Looking for a reliable partner to bring your project to the next level? Whether it’s development, design, security, or ongoing support—I’d love to chat and see how I can help.

Get in touch,
and let’s create something amazing together!

RELATED POSTS

Let’s cut through the noise: FAQ schema isn’t dead. But if you’re still using it the same way you did in 2022, you’re kinda missing the entire point of why it matters now. Google dropped a bombshell back in August 2023 when they restricted FAQ rich results to only government and health websites. So yeah, […]

So you’re paying for Adobe Creative Cloud just to use a few web fonts? Yeah, I’ve been there. Adobe Fonts (formerly Typekit) is great and all, but let’s be real: not everyone wants to shell out for a subscription just to load some pretty typography on their website. Plus, there’s that whole GDPR thing where […]

This is my own task / project / workflow solution fully integrated into WordPress, which I began developing in 2025. After the recent cloud outages—and following a significant investment in the Asana ecosystem—I decided to build a robust, self-hosted WordPress solution featuring an almost complete Asana Sync API integration. I don’t have plans to make […]

Alexander

I am a full-stack developer. My expertise include:

  • Server, Network and Hosting Environments
  • Data Modeling / Import / Export
  • Business Logic
  • API Layer / Action layer / MVC
  • User Interfaces
  • User Experience
  • Understand what the customer and the business needs


I have a deep passion for programming, design, and server architecture—each of these fuels my creativity, and I wouldn’t feel complete without them.

With a broad range of interests, I’m always exploring new technologies and expanding my knowledge wherever needed. The tech world evolves rapidly, and I love staying ahead by embracing the latest innovations.

Beyond technology, I value peace and surround myself with like-minded individuals.

I firmly believe in the principle: Help others, and help will find its way back to you when you need it.