7 Ways to Make WooCommerce Faster Before Black Friday -

7 Ways to Make WooCommerce Faster Before Black Friday

Black Friday, Cyber Monday, and the Christmas shopping season are merging into a two-month long cyber sprint this year thanks to COVID-19.

WooCommerce-powered websites have advantages over Shopify and other e-commerce platforms because you can tweak and fine-tune your site to your needs.

Out of the box, your site can run fine. But your website visitors have a high bar for shopping. We know customers expect free, fast shipping and fast page load times and detailed product photos and videos. We know this because you and everyone else expect the same.

There are seven steps you can do to make your WooCommerce website faster and increase WooCommerce speed:

  1. Measure your site with GTMetrix and Google PageSpeed for more information [Easy]
  2. Clean up your WordPress and WooCommerce database [Medium difficulty]
  3. Optimize your product images [Easy]
  4. Increase or improve your website’s server resources [Easy with Convesio]
  5. Take a hard look at your website’s third party scripts [Easy]
  6. Use a solid site and platform caching plugin [Easy]
  7. Put your site behind Cloudflare [Easy with Convesio]

1. Measure your site with GTMetrix and Google PageSpeed for more information

Before we get started, head over to GTMetrix.com and Google PageSpeed. Put your domain name in the box and get a free report of how your site performs. Both will give you a letter or number grade. This will tell you a lot of why your pages or WooCommerce is slow to load.

This score is your starting point and can be a great way to find images, scripts, styles, and more that are taking up the most time to load.

Write these scores, their load times, and page size down to compare against later.

2. Clean up your WooCommerce database, fragments, styles, and scripts

Most WordPress sites use WooCommerce in addition to all the other pages, blog posts, contact forms, return policies, and information your site needs to host. WooCommerce’s cart fragments is a small snippet of code that activates site-wide to keep the cart updated. This is handy because it does it through AJAX, meaning it doesn’t need to refresh the whole page. The downside is it loads on every single page. A person reading a blog post or your homepage probably doesn’t have anything to add to their cart. The cart fragments can add up to about 500KB or 1MB per page of bandwidth.

You can safely disable cart fragments by adding this function to your functions.php file:


/** Disable Ajax Call from WooCommerce */
add_action( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11);
function dequeue_woocommerce_cart_fragments() { if (is_front_page()) wp_dequeue_script('wc-cart-fragments'); }

You should consider doing this if:

  • Most of your website is informational pages or posts
  • Customers are unlikely to add more than a few items to their cart on any product page
  • You’re looking for every byte of performance

You can go further by adding this script to your functions.php file to prevent WooCommerce’s 3 default stylesheets from loading on non-WooCommerce pages:


if ( function_exists( ‘is_woocommerce’ ) ) {
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);
}
}
add_action(‘wp_enqueue_scripts’,’wpb_load_woocommerce’);
function wpb_load_woocommerce() {
if( is_page(array( ‘shop’, ‘cart’, ‘checkout’ ) ) or ‘product’ == get_post_type() ) {
wp_enqueue_style( ‘wpb-woo’, get_stylesheet_directory_uri() . ‘/css/woocommerce.css’, ”, ‘3′, ‘all’);
}
}add_action( ‘wp_enqueue_scripts’, ‘wp_enqueue_woocommerce_style’ );
function wp_enqueue_woocommerce_style(){
wp_register_style( ‘mytheme-woocommerce’, get_stylesheet_directory_uri() . ‘/css/woocommerce.css’ );
if ( class_exists( ‘woocommerce’ ) ) {
wp_enqueue_style( ‘mytheme-woocommerce’ );
}
}
// Remove each style one by one
add_filter( ‘woocommerce_enqueue_styles’, ‘jk_dequeue_styles’ );
function jk_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;
}
// Or just remove them all in one line
add_filter( ‘woocommerce_enqueue_styles’, ‘__return_false’ );

You can also disable WooCommerce scripts, which includes a lot of jQuery elements, by using this script:


/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
//first check that woo exists to prevent fatal errors
if ( function_exists( 'is_woocommerce' ) ) {
//dequeue scripts and styles
if ( ! is_woocommerce() && ! is_cart() && ! 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' );
}
}
}

3. Optimize your product images

This is widely known to every website manager who has runs an online store. You can’t just upload photos straight off your phone or dSLR camera. The images are too big. For a WooCommerce store images will always be among the most bandwidth-gobbling parts of the page.

WooCommerce preview images are almost always square. 1200x1200px is perfectly adequate for most stores. Taking an image straight off your phone is likely 3x larger than they need to be. This doesn’t improve anything for the customer. It just slows them down. And mobile users will eat through their data plans loading images that are 3-4MB when they could be under 1MB. That’s not just bad for customers, it’s also rude and costs you and customers money!

You can automatically optimize your images using a service like ShortPixel. It’s not free, but it’s worth the price. For most stores, $10 will get you enough credits to fix all of your images.

As an added bonus, it’ll optimize every image in your WordPress media library, not just store photos. Enable the “make .webp” (pronounced like “weppy”) and all of your JPGs will become this new format. As of 2020, every major desktop and mobile browser supports .webp. They’re indiscernible from JPGs, have a smaller file size, and a single checkbox in ShortPixel’s settings will convert almost all of your images automatically.

4. Increase or improve your website’s server resources

If you’re using a shared hosting provider with legacy technology, like GoDaddy or Hostgator, you should move. The prices are cheap for a reason. The single best money you can spend is on solid WordPress hosting. Better hosting and hosting plans means everything loads faster.

Modern next-generation hosting providers like Convesio can improve a website’s performance doing almost no other work by 150%. Hosting with Convesio also opens up our new Pro Services. Meaning we can migrate your site, measure the results before and after, and help you optimize your site using the items shared in this guide, all automatically.

Convesio’s platform scales automatically, meaning you don’t need to mess with memory limits or storage or any other arbitrary technical measures. Hosting with Convesio is as straightforward as publishing a blog post or new product to your WooCommerce site.

Short of that, if you want to free up some database resources head into Your WooCommerce Settings > Tools > and “Clear customer sessions”. Do this before the holiday rush. Likewise, clear the WooCommerce Transients and Expired Transients cache, too. This will flush out old carts that have expired and customer sessions that never converted into paying customers.

5. Take a hard look at your website’s third party scripts

We see this a lot when clients ask about improving website speed. A quick glance at GTMetrix or Google PageSpeed shows dismal scores. Often the top suggestion is “Remove third party scripts”.

Those third party scripts include Google Analytics, the Facebook Pixel, ad networks and ad trackers, Twitter widgets, Facebook widgets, and other social media add-ons.

The truth is almost no one clicks on those “Share this page” widgets. You can verify this yourself using services like HotJar (temporarily, since it’s also a third party script) to record users anonymously. Twitter streams, Facebook “Like this page” boxes, and other widgets add a lot of bloat. If you want to encourage users to Follow or Like you, consider a simple widget or block that uses an image, some CSS, and a little text with a link to your profile.

If you’re not using the Facebook Pixel, maybe because you tried it once and haven’t come back to it since, consider removing it. You can always add it back later.

Google Analytics is likely still important to your business, but if you’re not using Google Tag Manager to install the script, you should. The new method promises reduced script usage and improved load times.

Your internal plugins may also be running heavy scripts that do nothing but slow sites down. Some common ones include:

  • Broken link checkers that run automatically every few hours or days
  • Event calendar plugins
  • Site builders like Divi, Elementor, and Beaver Builder (handy, but they have tradeoffs!)
  • AdSense and other ad network plugins

6. Use a solid site and platform caching plugin

Your website host may already have built-in caching. Convesio does and the performance gains can be as much as 2-3x faster. But you can also run a local caching plugin like WP Fastest Cache or WP Rocket. WP Rocket is $49, but it’s well worth it and we often include it as part of our Pro Services optimizations (free of charge).

Configuring WP Rocket is almost automatic during setup. Just be sure to test your site before, during, and after setup in a private window so you see your site how users are likely to see it. Things like “defer Javascript” and “Minify scripts” can cause your site to break.

7. Put your site behind Cloudflare

Cloudflare.com operates a world-class content delivery network (CDN) and DNS resources. Convesio customers can get their site behind Cloudflare’s Enterprise platform with a simple request at setup. This will automatically block bad or malicious traffic, bots, and free up your real human visitors to get the most resources from your site.

Or, use the free version of Cloudflare to get their advanced keep-alive and global site caching systems.

To get started, you’ll need a Cloudflare account, access to your domain name’s DNS, and if you’re using a caching plugin like WP Rocket, you can add your account information there to further optimize settings.

Convesio’s Pro Services can also handle this setup for you automatically.

Re-check your WooCommerce pages and homepage load times (and test for concurrency too)

Now that you’ve deferred, optimized, moved, and tidied up your site database, check your page speed again at GTMetrix.com and Google PageSpeed.

Remember, too, that your visitors don’t always land on the homepage. So test your most popular posts, pages, and products individually. You may discover additional scripts and images that you can tweak to perform better.

You should also perform load testing to see how many concurrent visitors your site can handle. If you’re expecting a big spike in traffic (or perhaps not, but want to be ready for one nevertheless) you should check at what point your WooCommerce stores starts to slow significantly. We’ve covered this in our recent Is Your WooCommerce Hosting Black Friday Proof? post – check it out.

A good host can make all the difference

If you’re ready to consider different hosting providers, get started with Convesio by creating a free trial account today. By the holiday rush this year or next, your site will be ready.

Get a free review of your WooCommerce store

We’ll run tests to check performance, identify bottlenecks and understand if your current hosting plan is able to handle sudden spikes in traffic.

REQUEST A REVIEW 30-DAY FREE TRIAL

Justin Harter

Justin spends much of his time working on websites, following politics, and taking photos of funny things he finds lying on the ground. He was also born the same day The Simpsons were.

No Comments

Post a Comment

Comment
Name
Email
Website