Troubleshooting a slow WooCommerce store

Published on 2021/03/05


Last updated on 2021/04/25


by Dejan Murko

Featured post image

In this blog post, we’ll be troubleshooting server performance issues on your WooCommerce store. We won’t be talking about the general speed optimizations – we covered those in our blog post Speed up WooCommerce – but when your site grinds to a halt without an obvious reason or when you do everything right but the store is still slow.

In our experience helping WooCart users troubleshoot, we’ve seen three main issues: license checks, external script loading, and errors. These can be split into two categories: browser and server issues. Both impact load time but the server issue will show itself in poor time to first byte (TTFB).

The below processes will also help you find any other issues your store might have.

Poorly written license checks (server issue)

Premium plugins or themes check that your license is valid so that you can use premium features. But then there are plugins that check for the license on every page load which results in an unnecessary increase in load time. This happens with way too many plugins and there is nothing you can do but replace the plugin or annoy authors to change how they do license checks.

In an extreme case that happened to one of our users, the license server went down and did not allow the website to load until the timeout occurred (after more than 30 seconds).

So how can you check if this is happening with your store?

You need WP-CLI on your server and then you need to install profile-command by running

wp package install

If your hosting does not have WP-CLI, and you are serious about your store performance, you should move to one that does. Most premium WordPress hosts have it.

If you’re looking for a host that specializes in WooCommerce, then visit our homepage and explore all the benefits that we offer our clients.

We’ll start by running

wp profile stage --all --fields=hook,time,request_time --spotlight

for the list of hooks and their respective load time.

In this example, we see the init has a load time of 13s execution of a PHP code and a request time of 5s from the remote server response time.

Now, let’s profile that hook by running

wp profile hook init --fields=location,time,request_time --spotlight

And we see the file that is running this hook, which is in our example the license check.

On WooCart, you would also see this issue under the Errors tab:

The only solution to this is to disable the offending plugin and complain to the authors about their license checks.

Errors (server issue)

Another issue that can potentially slow down your store is errors in code. They usually result in something not working correctly, but not always, and not necessarily easily seen from just browsing the store.

To find some of these errors, install the free plugin Query Monitor. If the store does not even load, then you’ll need to use the WP-CLI profiler as in the above license check example.

When you activate Query Monitor, it adds a new section to the administrator’s navbar. It also clearly shows when there are errors (highlighted in red):

In our example, when we open the HTTP API Calls it shows that the Stripe plugin had an error that adds 630ms to the page load.

In a case like this, it’s best to turn to the plugin authors for help. Send them the screenshot of the errors and request assistance.

External script loading (browser issue)

Depending on how you’ve set up the loading of scripts (i.e. if you are deferring them), this might not show as slow page load for the human visitor browsing, but mostly in poor score on speed tests. That said, it does not mean you can leave slow scripts on the store.

If you use any type of custom fonts, analytics, or chat, your store is loading scripts from another server. If that server is slow or unresponsive, the load time of your store will suffer. Another reason might be the sheer size of the scripts that need to load.

You can find the scripts loaded by opening the browser console and going to the Network tab. You might need to add the Duration column so that you see the actual load time of each request. Refresh the page and it will show you all the requests that happen when your page loads.

Requests load simultaneously (so it’s not one after the other) and the browser recommends a load time below 500ms. Firefox shows you a turtle icon next to slow requests.

As you can see in our image above, the live chat script has three requests that take longer than 500ms. This is a potential improvement as there are chat scripts that load much faster.

If you see this and the load time is consistently poor, your only option is to replace the service or plugin.

Or is everything your theme’s fault?

But what if it’s none of the above? Then the obvious answer might be the theme. Here’s how to figure out if your theme is the culprit.

Chrome gives you the best overview for this with its Performance tab (right-click anywhere on the page, Inspect Element, and open the Performance tab). To get the clearest picture, use CPU throttling at 4x to simulate an average mobile phone.

Here is a screenshot of Astra theme performance:

And a screenshot of Woodmart theme performance:

Focus on loading, scripting, and rendering, plus the total blocking time at the bottom.

As you can see, there are major differences between the two. These two themes are the fastest (Astra) and second-slowest (Woodmart) themes tested on our benchmark test. When you’re looking at your store, you want to be as close to Astra results as possible.

If you need to replace the theme, then read our speed test to find the fastest WooCommerce theme.

We hope this blog post helped you find your issue!

Dejan Murko

Dejan is the WooCart co-founder and Project Lead.

See other posts »

Learn How to Speed up Your WooCommerce Store

The best tips for the 80/20 results/effort ratio.