Have a slow WooCommerce site?
I’ll show you how to make it faster by fixing items in GTmetrix/Pingdom (the same tips I used to get 100% GTmetrix scores). I’ll also show you how to optimize WooCommerce cart fragments, styles, scripts, product images, databases, CDNs, and other tips shown in the table of contents.
Is my site WooCommerce? No. But my developer and I have made multiple WooCommerce sites to typically load 3x faster. And if you need help, you can hire him on freelancer.com for $40/hour. He has a perfect 5 star review, an extensive portfolio of websites he’s optimized. I’ve been working with him since 2011 (his name is Pronaya) and can’t recommend him enough.
Otherwise, follow this guide and feel free to post questions (or your results) in the comments.
1. Disable Cart Fragments
The easiest way to disable WooCommerce cart fragments, scripts, and styles, is with Kinsta’s perfmatters plugin. It also lets you disable unused widgets (including WooCommerce widgets) to make the admin load faster and has other features like disabling the WooCommerce status metabox, disabling scripts on a page/post basis, limiting post revisions, autosaves, heartbeat control, and other things that can reduce CPU and make your WooCommerce site load faster. If you don’t want to pay $25/year, I listed alternative methods below (using code from Github).
By default, WooCommerce uses cart fragments which is used to update the shopping cart without refreshing the page. But this isn’t needed on your homepage (or other pages) and can be disabled for better performance. Otherwise, cart fragments will load on every single page.
What cart fragments will usually do to your GTmetrix/Pingdom report:
To disable cart fragments, add the code to your funtions.php file:
2. Disable WooCommerce Styles
WooCommerce loads 3 stylesheets on every page of your website. Since you probably don’t want these loading on every single page, you should disable them on non-eCommerce content.
Disable all WooCommerce stylesheets:
Disable specific stylesheets:
If you disabled specific stylesheets, you will need to add your own:
3. Disable WooCommerce Scripts
WooCommerce also causes lots of scripts:
The solution below only loads WooCommerce scripts on the shop, checkout, and cart pages.
Add this to your functions.php:
If that doesn’t work, there are a few alternative solutions on Github people had success with.
4. Clear Customer Sessions
In your WooCommerce Status settings, clear customer sessions:
5. Clear WooCommerce Transients
In your WooCommerce Status settings, delete all transients:
6. Disable The WordPress Heartbeat API
The WordPress heartbeat API shows you real-time plugin notifications, and when other users are editing a post. This generates a request every 15-60 seconds and will drain CPU, so it’s best to use a plugin like Heartbeat Control plugin to disable it, or at least limit it to 60 seconds.
If using WP Rocket, they also have an option for this:
7. Use A Lightweight WooCommerce Theme
I always recommend StudioPress themes which are also recommended by Matt Cutts and even Matt Mullenweg. Many themes, including Avada, are bloated with unnecessary features, and some themes may not be coded or maintained well. StudioPress is supported by a reliable team (recently acquired by WP Engine) with documentation, frequent updates, support, and coded with speed, SEO, and security in mind. I use their Outreach Pro theme and am loving it.
Themes I recommend from ThemeForest:
8. Resize Product Images To Smaller Dimensions
This is what serve scaled images means in GTmetrix.
GTmetrix tells you which images are too large, and the correct dimensions they should be resized to. Save the image from GTmetrix, resize it to the correct dimensions, and replace the old image with the new one. Do this with all oversized images on your WooCommerce site.
I suggest starting with images that appear on multiple pages (eg. logo + sidebar images) then working your way through individual pages, since GTmetrix only shows image errors for the single page you test. I also recommend creating an “image cheat sheet” as I’ll explain below.
Create a cheat sheet for your most commonly used images:
- Slider images: 1903(w) x 400(h)
- Carousel images: 115(h)
- Widget images: 414(w)
- Fullwidth blog post images: 680(w)
- Featured images: 250(w) x 250(h)
9. Don’t Use Too Many Extensions
Just like plugins, too many WooCommerce extensions will make your website slow:
10. Use A Better Cache Plugin
There are 3 factors when it comes to cache plugins:
- If you’re using a cache plugin
- Which cache plugin you’re using
- Whether you’ve configured the optimal settings
For free, I recommend either Swift Performance or WP Fastest Cache. But if you’re willing to drop $49, WP Rocket was rated #1 in most Facebook polls. That’s because it comes with a ton of features most cache plugins don’t, in which case you would need about 6 additional plugins:
- Database cleanup (built-in to WP Rocket, or use WP-Optimize)
- Heartbeat control (built-in to WP Rocket, or use Heartbeat Control)
- Lazy load images/videos (built-in to WP Rocket, or use WP YouTube Lyte)
- Host Google Analytics locally (built-in to WP Rocket, or use CAOS For Analytics)
- Host Google Fonts locally (built-in to WP Rocket, or use CAOS For Fonts, or SHGF)
- Integration with Cloudflare + other CDNs (built-in to WP Rocket, or use CDN Enabler)
11. Avoid Resource-Hungry Plugins
These are the most common plugins that drain CPU, but there’s a full list of them.
You can also find slow loading plugins in your GTmetrix Waterfall chart. If they appear multiple times, take a long time to load, or generate multiples requests, you will know something’s up.
Or use Query Monitor (check the “queries by components” tab):
You don’t need that many plugins!
12. Delete Unused Themes + Deactivated Plugins
All themes and plugins you don’t used should be deleted. Deactivated plugins and unused themes store settings in your database and are unnecessary. If you’re not using it, delete it!
13. Compress Images With ShortPixel
This is what optimize images means in GTmetrix.
I use ShortPixel which is what one of the most popular image optimization plugins, with Imagify, Kraken, and Smush also being popular. All these plugins do the same thing – compress images, strip EXIF data, and optionally resize images that are too large. Once you’ve configured the settings, compress a few images in the Media section. If you’re happy with the quality, bulk compress all images on your site. Though, I would still take a backup just in case.
Check out my full guide to optimizing images in WordPress for more tips.
- Serve scaled images: resize large images to correct dimensions
- Specify image dimensions: specify a width/height in the image’s HTML or CSS
- Optimize images – losslessly compress images
- Combing images using CSS sprites – combine multiple images into 1 image
- Avoid URL redirects – don’t serve images from wrong www or http(s) version
- Use a content delivery network – serve images/files from a CDN
- Leverage browser caching – cache images/files using your cache plugin
- Make favicon small and cacheable – use a 16x16px favicon and cache it
14. Clean Your WooCommerce Database
You can use WP-Optimize or WP Rocket to schedule a database cleanup every 1-2 weeks. This deletes garbage files like expired transients, spam comments, pingbacks, trackbacks, database tables, drafts, and the potentially thousands of post revisions that accumulate over time (that is, if you don’t use plugin like permatters to limit them). Always take a backup before doing it!
15. Clean Your WordPress Backend With Clearfy
There’s a lot of stuff built-in to WordPress you probably don’t need. Clearfy can help you clear it up. You can usually disable jQuery Migrate, RSD links, wlwmanifest link, shortlinks, post revisions, autosaves, heartbeat, dashicons, and many other options. WP Disable is good too.
Kinsta’s permatters plugin is similar, but comes with even more features:
16. Block Bad Bots
Are bad bots crawling your site and consuming CPU? They were for me, a lot of them actually.
Step 1: Install Wordfence.
Step 2: View your live traffic report.
Step 3: Find spam bots in your live traffic report (if the same bot is constantly hitting your site and looks suspicious, Google it’s hostname and see if other people reported it as spam).
Step 4: Block the spam bots.
Wordfence itself can cause high CPU (but is good for seeing IF you have spam bots). I recommend blocking them using the Blackhole For Bad Bots plugin, or with Cloudflare firewall rules. Wordfence and Cloudflare have a log so you can see whether the bots are actually being blocked. If successful, you can uninstall Wordfence and use Cloudflare or the Blackhole plugin.
17. Upgrade To PHP 7.2
WooCommerce sites should always be running a fast PHP version (eg. PHP 7.2) which you can upgrade in your hosting account. Higher PHP versions make your site run much faster, even though most WordPress users run outdated PHP versions (since they don’t know how to do it).
Check which PHP version you’re currently running in the Status section of WooCommerce:
Then upgrade to PHP 7+ in your hosting account:
Some plugins are not always compatible with higher PHP versions (another reason you should be careful which plugins you use). Run the PHP Compatibility Checker to make sure your plugins are compatible. If they are, you can safely upgrade, but check your website for errors.
18. Combine Google Fonts
Google Fonts are external resources and will show up in your GTmetrix/Pingdom report:
Option 1: Install Autoptimize and use “Combine and link in head” option:
Option 2: Try the CAOS for WebFonts plugin:
19. Setup Cloudflare’s Free CDN
There’s absolutely no reason you shouldn’t be using Cloudflare’s CDN.
It hosts your website on 165+ data centers across the world. This reduces the distance between your server and visitor, while offloading resources to their data centers (putting less stress on your origin server). Cloudflare is easy to setup – sign up for a free plan, run the scan, and they will assign you 2 namesevers which you will change in your hosting account. You can do other things with Cloudflare like enable hotlink protection, Rocket Loader, and utilize page rules to make your WooCommerce site even faster – all done in your Cloudflare dashboard.
Multiple CDNs = more data centers = faster delivery of your content. If you want to go the extra mile, use both Cloudflare and a CDN like StackPath (I use both). StackPath has 31 additional data centers. While Cloudflare requires you to change nameservers, StackPath (and other CDNs) will ask you for your website, then generate a CDN URL which you will paste into your cache plugin (most have an option for this), or you can also use the CDN Enabler plugin.
20. Pinpoint The Problem With Query Monitor
Query Monitor has a ton of information that can help you debug why your WooCommerce site is slow. It shows you slow loading queries, PHP errors, hooks and actions, block editor blocks, enqueued scripts and stylesheets, HTTP API calls, and more. Fixing items in Query Monitor may require some technical knowledge, but is worth hiring a developer who can fix the issues.
You can also use AWStats (commonly found in the “statistics” section of your hosting count which tells you which bots, images, files, and other elements that are consuming the most CPU.
21. Ignore Google PageSpeed Insights (Use GTmetrix)
If you join the WordPress Speed Up Facebook Group, or look at WP Rocket’s article, you’ll learn that Google PageSpeed Insights is not a great tool for measuring (or optimizing) your site – it doesn’t even measure load times! Pingdom is one of the most accurate tools for measuring load times, but for actual performance recommendations I (and most people) prefer GTmetrix.
When testing your WooCommerce site, always check your GTmetrix Waterfall chart to see which requests take longest to load (eg. WooCommerce cart fragments, specific plugins, etc).
The only thing Google PageSpeed Insights is good for is measuring server response times:
22. Avoid EIG Hosting
The same company (EIG) owns over 60 different hosting companies. It is well-known in Facebook Groups that they pack too many people on the same server, use outdated PHP versions and speed technology, and don’t care about clients. Cheap hosting = cheap results.
- Are you using an EIG brand (Bluehost, HostGator, Site5, iPage, HostMonster)?
- Are you running your WooCommerce site on a $4/month hosting plan (eg. GoDaddy)?
Don’t expect a WooCommerce site to be fast on a cheap hosting plan, let alone have a decent server response, time to first byte, and enough CPU to compensate for lots of extra plugins. Generally, WooCommerce sites need a better hosting plan to compensate for more plugins, scripts, and CPU usage. And EIG, GoDaddy, and other low quality plans aren’t going to cut it.
23. Check CPU Usage And Server Response Times
24. Use Fast Hosting That Can Support WooCommerce
I use SiteGround and have 200ms response times with 100% GTmetrix scores and .4s Pingdom load times. Do a hosting check, run your own tests, or click through my fast loading pages. They were rated the #1 host in 26 Facebook polls and are worlds better than EIG (Bluehost, HostGator), GoDaddy, and other hosts who pack too many people on the same server. There have been plenty of people who migrated and posted results on Facebook and Twitter. Tweet after tweet, post after post, poll after poll after poll, faster hosting will fix slow response times. They’re recommended by WordPress, do free migrations, and I use their semi-dedicated plan.
SiteGround has 3 plans which are 77% off for Labor Day:
Higher plans include more server resources (#1 factor in the WordPress optimization guide). Here’s the full comparison chart, but GrowBig gives you about 2x more server resources than StartUp, and GoGeek is semi-dedicated hosting which gives you even more. GrowBig and up comes with a free migration, staging, advanced caching, and ability to host multiple websites. GoGeek comes with priority support. Their cloud hosting is quite the price jump at $80/month.
You can see this on their features page:
You can decide for yourself.
I hope this helped! Comment if you have questions.