WooCommerce is easily the most popular WordPress e-commerce plugin, and is in fact one of the most popular e-commerce systems across all platforms — particularly for small to medium sized stores.
Hosting WooCommerce with WP NET is also proving very popular — almost half of our Managed WordPress customers use WooCommerce!
WooCommerce Makes WordPress Work Hard(er)
A WooCommerce site requires regular maintenance and a bit of housekeeping to keep things running smoothly. When you’re using WooCommerce your WordPress database does a lot more work — cart sessions, sales, user reviews, product searches and complex product data all create serious work for your database. Without a little regular maintenance, we’ve seen some busy store’s database bloat to a few hundred MB and page load can start to really suffer.
The latest version of WooCommerce — version 2.5 — has addressed some of these problems by shifting session data into it’s own table in the WordPress database, but WooCommerce still makes heavy use of WordPress Transients, and while transients are supposed to tidy up after themselves — this isn’t always the case. You can read more about WordPress Transients (and how to maintain them) here and here.
Although some people might tell you otherwise — the fact is — operating a WooCommerce site with several hundred products and customers and dozens of sales per day on just about any kind of shared-hosting platform — and keeping your page load fast — just isn’t realistic. By fast I mean category, product, search and cart pages loading in about 2 seconds, or less.
If you’re online business is generating thousands of dollars per month in revenue, don’t skimp on hosting – get yourself a VPS server. Not only is a VPS (Virtual Private Server) a lot faster than shared hosting, it’s more secure (well, it can be) and it is easier to customise and optimise to your specific needs.
Whether you have a large WooCommerce store on your own VPS or a modest-sized one on shared-hosting, a little housekeeping now and then will go a long way to keeping things running smoothly.
First Stop: WooCommerce System Status
WooCommerce provides a few handy tools built right in to the WordPress Admin, and these are your first port-of-call. In your WordPress Admin, go to WooCommerce -> System Status.
This page contains a lot of very useful information. It will highlight any serious issues such as incompatible server software or under resourced settings like memory allocation. It will also summarise your WooCommerce database configuration and it will list any WooCommerce extensions that have updates available. It also checks that the standard WooCommerce pages exist and summarise other settings and configuration data.
The last section of this page is particularly useful: Templates (Overrides). This section will list all your theme’s WooCommerce templates and highlight any that are out-of-date with the currently installed version of WooCommerce. If you have out-of-date templates you should check if your theme author has a new version available and contact your WordPress developer and ask them to install the new version for you. If you’re a WP NET customer, you can ask us to do this for you too.
Digging Deeper: Tools
Next, click the Tools tab at the top of the page, this is where we can actually do some optimising, but be careful — don’t click anything until you have carefully read what it does, there’s a couple of dangerous buttons here!
There is only two buttons on this page that we’ll be concerned with in this case: Clear transients, Clear expired transients.
We’ll start with Clear expired transients. As we touched on earlier, transients don’t always get removed from the database when they expire — they should — but they don’t. Why and how is beyond the scope of this article, so let’s just focus on what we can do about it.
I just chose at random a small WooCommerce site on one of our shared Managed WordPress hosting servers and hit the Clear expired transients button (with the user’s permission, of course!). Even though this site has only a little over 100 products and only a handful of orders, clearing the expired transients removed over 1200 rows from the database! We’ve seen busy sites with hundreds of thousands of expired transient rows in the database.
Next, we’ll try the Clear transients button. This removes all transients cache data created by WooCommerce used for the products and shop pages.
Is it safe to remove transients? Yes. By definition, transients only store temporary, non-volatile data — so you can safely remove transients. The exception being that a theme or plugin author could use transients inappropriately. In my experience this is very rare, and if a plugin or theme uses transients for permanent data storage you should discontinue using it. If you’re a WP NET customer and experience problems after removing transients, please contact us and we’ll help (we always have backups of your database we can restore if need be).
The following sections are not specific to WooCommerce – any WordPress site will benefit from these tips.
Optimising Your Database
There are many WordPress plugins available to help you remove clutter and redundant data from your database — some are good, some are not so good — care must be taken when ever your performing these kinds of actions, so it’s a good idea to make a backup first 1.
The plugin we recommend for database maintenance is Optimize Database after Deleting Revisions. Although the name doesn’t suggest it, this plugin actually does much more that simply removing revisions and optimising the database tables. It can also remove expired transients, unused tags, orphaned metadata items, trashed items and more.
It is important to remember that optimising database tables should always be the final step. Only do this after you have removed expired transients and other redundant rows from your database, this will consolidate the freed up space, reduce the size of your database and improve performance.
You should always use a caching plugin on your WooCommerce sites, this will dramatically speed up page load times and reduce database usage. We recommend the WP Super Cache plugin, it’s simple to configure and works very well. We recommend that you use the mod_rewrite option — it provides the best performance and works fine with most web hosts, including WP NET.
Our generally recommended options are:
- Cache hits to this website for quick access — enabled (this turns on page caching)
- mod_rewrite — enabled
- Compress pages so they’re served more quickly to visitors — enabled (not required for WP NET customers, as this is enabled server-wide)
- Don’t cache pages for known users — enabled
- Don’t cache pages with GET parameters. (?x=y at the end of a url) — disabled (see explanation below)
Note that after enabling caching and clicking the Update Status button, you should then click the Update Rewrite Rules button to ensure that your .htaccess file is updated.
Finally, if you are prompted to do so, you should configure garbage collection. This is the interval after which old cached files are cleared out. The default setting of 3600 is usually fine, just scroll down to the Expiry time and garbage collection section and click Change expiration.
Don’t cache pages with GET parameters
With this option enabled, any WordPress page that has a query string in the URL (for example: www.myonlinestore.nz/products/widgets?orderby=date) will not be cached, which means a “live” dynamic version of the page will be served every time. Unless you specifically need it, I recommend that you leave this disabled.
Some developers believe that pages like search results (?s=widgets) and filtering (&orderby=price) should not be cached — and there are some good reasons for this — however, my view is that if there are pages with GET parameters that you don’t want to cache, it’s better to exclude them specifically, rather than simply excluding all pages with GET parameters. Basically, this setting is just too broad, and a more refined approach is probably better — and you can do this with the Accepted Filenames and Rejected URIs settings.
Accepted Filenames & Rejected URIs
One example of a scenario where you might need to exclude a page from caching is if your WooCommerce site uses a “Wishlist” plugin. As with the Cart, Checkout and My Account pages, the Wishlist page is unique for each user, so caching it would not be a good idea.
When you do need to exclude pages from the cache you can use the Accepted Filenames & Rejected URIs settings. In the last part of this section, there is a field where you can add text — which when matched to the current URI — will exclude the matched page from the cache. The field is always pre-populated with two lines for WordPress defaults, and you can simply add more as needed.
In the example below, we’re excluding any page that includes “wishlist” in the URI. Note that your site’s actual wishlist page URI may be different. I should add that some Wishlist plugins work around possible caching issues by using AJAX to populate and update the Wishlist page, which means that you don’t need to add an exception at all.
Final Notes on Caching
If you use the W3 Total Cache plugin, check this trouble-shooting post on the WooCommerce site to resolve an issue with orders not being marked as complete after payment is processed.
Ensuring that your product and category images are optimised and not too large will also help with page load times. There are many tutorials available on the web explaining how to go about optimising your site’s images and setting your WordPress Media and WooCommerce Product Image settings correctly. Many WooCommerce themes also vary in how they handle, optimise, cache and display images, so there’s no one-size-fits-all solution.
Check the Further Reading and Resources section at the end of this post for some links to help you with image optimisation in WordPress and WooCommerce.
Note that if you change any of your site’s image dimension settings you will need to regenerate images to apply the changes. The Regenerate Thumbnails plugin can do this for you.
There are two WordPress plugins we recommend for minification:
- W3 Total Cache — this is a very comprehensive caching and site optimisation plugin (an excellent alternative to WP Super Cache if you need more flexibility) which also includes sophisticated tools for code minimisation.
From the perspective of a developer or host-master, revisions do pose a problem — they can seriously bloat your database. By default, self-hosted WordPress stores revisions indefinitely! WordPress.com only stores 25 revisions, which is much more reasonable. It would seem that the WordPress developers believe that this decision is best left to the individual user / developer to determine on a case-by-case basis.
Furthermore, the WordPress auto-save feature uses revisions to save your posts and pages automatically — every 60 seconds by default. Again, this really does seem like overkill — on a shared-server, having all these users writing posts, with auto-saves firing off every 60 seconds can start to negatively affect performance.
As a Managed WordPress host, we at WP NET take some responsibility for this and we automatically apply two changes to all sites on our shared-hosting Managed WordPress servers:
- We disable revisions: define( ‘WP_POST_REVISIONS’, 0 );
- We increase the auto-save period to 5 minutes: define( ‘AUTOSAVE_INTERVAL’, 300 );
We’re not alone, other Managed WordPress hosts do this too. If you do want to override this, it’s easy enough to do. If you’re a WP NET customer and you really do want to use revisions, just open a support ticket and we’ll enable them for your site. Although, we strongly discourage you from using the default (-1: keep all revisions) and instead recommend that you try something from 3 – 10.
Note that disabling revisions does not disable the auto-save feature.
Further Reading and Resources
If you’re hungry for more, check out the following links for more help and tips with optimising and maintaining your WooCommerce site:
- Optimal Image Compression in WordPress (WooThemes)
- Using Appropriate Image Dimensions in WooCommerce (WooThemes)
- Troubleshooting a Slow Site (WooThemes)
- Complete Guide to Image Optimisation for WordPress
- Speeding up WordPress: Image Optimisation
- Regenerate Thumbnails plugin
I hope that you found this post useful and informative. Vigilance is the key — you should consider doing a performance review every month or so, depending on how large and busy your WooCommerce site is.
If you’re a WP NET customer you can do all these things yourself, or you can hire our highly-experienced WordPress developers — including me 😉 — to do it for you.
1 iThemes Security is a free plugin which can backup your database — though note that you can’t restore a backup with it — you would need to use phpMyAdmin to import the backup should you need to. BackupBuddy does provide database backup and restore features, so that’s a better choice. Of course, there are many other options available — both free and paid.