Speed in eCommerce is a must and if your website loads slowly you are losing customers. You want to decrease your page load and make your customers happy but also Google because page load time is a ranking SEO factor.
Your website speed is not the score you get from google page speed or gtmetrix, but the perceived time a website loads for your website visitors. You first must optimize for the visitors not for made up metrics.
When measuring your website speed you should measure the loading time on your home page, product page, category page, blog page, landing pages. The loading time on each might be different, depending on their size, the number of requests on each and more.
WooCommerce is a great shopping cart but sometimes it can be a hassle to optimize, especially if you go over a few thousands of products.
How can we make WooCommerce faster?
There can be several things:
1. Hosting
2. Theme
3. Plugins
4. Images
5. Caching
6. CDN
7. Wp-config
Hosting
What can we do about a slow hosting? Well before moving to another host that might be more expensive we can tweak a thing or two. Let’s find out what PHP version we are using, in Cpanel is easy to do and if it uses PHP 5.6 and you have to option to upgrade do so, PHP version 7.2 it will make a very big difference from the start.
If you are on a manged hosting usually they take care of everything for you, this is the easy way to have a fast WooCommerce site.
If you are hosting with on own VPS from AWS, Digital Ocean, Linode or other provider I suggest to manage it with ServerPilot, Laravel Forge or maybe GridPane, it’s easy and you control a lot settings easily without getting your hands dirty in administering the VPS.
Theme
This is touchy one, many themes try to do everything and they are not optimized for that, as they are loaded with options. More options more problems, and conflicts with plugins or custom code. The best way to go is for a simple theme, that does what you want and also has ongoing support and updates. Or you can start from the free WooCommerce theme Storefront.
Plugins
The number of plugins and their quality influence the speed of your WooCommerce website as not all are optimized and can increase the load of the website. Sometimes these plugins are poorly developed, loading in the frontend on every page, so making your website slower with each one you add. The best thing to do is after each plugin you install is to test your website speed on all pages mentioned at the start.
Images
Image optimization is a must, usually on a ecommerce website you want crisp images for your products and usually there are multiple images per product, this means the page loads slower as the browser needs to download more and larger images. There are many options out there to optimize your images, my favorite now is ShortPixel. It has a free plan but you will go over it fast. Default setting should be ok for everyone but make sure you only optimize the images your theme uses.
Caching
There are some great caching plugins out there now, my fast optimization plugin is Wp-Rocket. Easy to setup and fast to fix if something breaks on the front end. Bellow I’ve added screenshots of a large website (10.000+ products) with WooCommerce and WP Rocket.
CDN
A CDN (Content Delivery Network) helps offload your server by caching your images and resources in different locations around the world and serving them to your visitors from the closest location to the visitor. If your website is hosted in US and you have visitors from UK these visitors will download the content in the browser from the UK CDN server loading the website faster. Any CDN is good, except free ones in my opinion. You need to make sure you really need a cdn, if you have a small website with not so many visitors and mostly from the country you host the website you might be better off. Test, test, test.
WP-CRON
Disable wp-cron and use an external cron that runs every 30 minutes.
[php]
/* disable cron for speed */
define(‘DISABLE_WP_CRON’, true);
[/php]
WP-CONFIG
Some sample snippets to help you optimize your wp-config.php file for WordPress and Woocommerce store. Edit and enable or disable as you need for your store.
[php]
define(‘WP_CACHE’, true); // Added by WP Rocket
/* define(‘CACHE_EXPIRATION_TIME’, 3600); // in seconds */
define(‘DISALLOW_FILE_EDIT’, true);
define(‘WP_SITEURL’, ‘https://website.com’);
define(‘WP_HOME’, ‘https://website.com’);
/* Change WP_MEMORY_LIMIT to increase the memory limit for public pages. */
define(‘WP_MEMORY_LIMIT’, ‘128M’);
/* Uncomment and change WP_MAX_MEMORY_LIMIT to increase the memory limit for admin pages. */
define(‘WP_MAX_MEMORY_LIMIT’, ‘1024M’);
/* disable cron for speed */
define(‘DISABLE_WP_CRON’, true);
/* define(‘COOKIE_DOMAIN’, ‘.website.com’); */
define(‘CONCATENATE_SCRIPTS’, false );
define(‘WP_POST_REVISIONS’, 3); // any integer, but don’t get too crazy
[/php]
WP Rocket Setup Woocommerce
Bellow you have the setup of WP Rocket on a shop with 10.000+ products. It might not be ideal but this is what worked on this particular setup.
The prefetch settings I am using:
[sourcecode language=”plain”]
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
//api.pinterest.com
//cdnjs.cloudflare.com
//pixel.wp.com
//connect.facebook.net
//platform.twitter.com
//syndication.twitter.com
//platform.instagram.com
//disqus.com
//sitename.disqus.com
//s7.addthis.com
//platform.linkedin.com
//w.sharethis.com
//s0.wp.com
//s.gravatar.com
//stats.wp.com
[/sourcecode]
There are other options to improve your shop depending on the size of your shop and budget, load balancing, memcached, varnish and others. Some of the options are paid and not everyone want to spend the money, bigger server, CDN, paid plugins, image optimization, load balancing, support and so on. Make sure you add a SMTP server to your server, it will help a lot.
We will update the post if something new comes up, please let me know in the comments if I missed something.