It’s imperative that you cache WooCommerce to speed up page loading times since 51% of customers abandon the cart if the website loads slowly.
Caching saves a static version of your site so it can load much faster on each subsequent visit.
But, there are many crucial caching details that are often overlooked.
Not to worry!
Here are 7 tips to solve the often forgotten caching pitfalls to ensure you cache WooCommerce properly to keep your customers happy:
- Use a Content Delivery Network (CDN).
- Add Page Caching into the Mix.
- Enable Object Caching.
- Include Opcode Caching.
- Setup Varnish Cache.
- Reduce or Cache API Calls.
- Minify While You Cache WooCommerce.
I Don’t Mean to Cache You off Guard
Before you jump at the opportunity to delight your customers and cache WooCommerce right off the bat, it’s important to note that not all of your store pages should be cached.
These dynamic pages shouldn’t be cached or else users won’t be able to complete their purchase:
- My Account
- Any widget or custom page that handles adding to cart, account, or checkout options
But, if you have the WP Rocket caching plugin, or WooCommerce 1.4.2 or higher installed, you can go ahead and disregard the above since it’s already taken care of for you.
For details, check out our article on How to Speed up a Slow WooCommerce.
1. Use a Content Delivery Network (CDN)
A CDN is a system of edge servers located around the globe that cache your website as static HTML.
No matter where your customers are around the world, they’ll be able to access a cached version of your site from the server that’s closest to them. That means if you use a CDN to cache WooCommerce, all your customers will be able to enjoy faster web page loading times.
You can check out our two articles:
- Cloudflare: Should You Use It or Not?
- Cloudflare vs CloudFront: How They Work, Plus Which is Best For You.
But, using a CDN isn’t the only type of caching you can take advantage of to help put your WooCommerce site into hyperdrive. You can also use page, object, and database caching as well.
Using a CDN with WP Rocket
If you choose to use a CDN to cache WooCommerce, you can set it to work seamlessly with WP Rocket for enhanced performance.
Under Settings > WP Rocket in your admin dashboard once the plugin is installed, go to the CDN tab.
Then, check the Enable Content Delivery Network box, and fill out the CDN CNAME(s) field. You can also add additional CNAMEs by clicking the Add CNAME button.
When you’re done, click Save Changes.
If you use Cloudflare or Sucuri, you can enable the corresponding addon by going to the Add-Ons tab and clicking the toggle button.
2. Add Page Caching into the Mix
Page caching takes all the HTML of a page and caches it on the first-page load. Every visitor after that will see a huge improvement in the site’s speed.
Implementing page caching alone can increase your site’s loading speed by over 88%.
Fortunately, you can install WP Rocket and automatically add page caching to WooCommerce without having to do anything else, like fiddling with a bunch of settings and options.
Although you can if you want to really go all in to skyrocket your site’s speed.
For details, check out Caching for WordPress, Explained in Plain English.
3. Enable Object Caching
Persistent object caching stores loaded query results so the next time they’re requested, they can be loaded from the cache instead of burdening the server and using up its resources.
Your database and server will be freed up and optimized, which results in faster web page loading times.
Redis and Memcached are two incredibly popular options for object caching, and they’re both compatible with WordPress, and WooCommerce.
They’re collectively used by top-performing sites like Twitter, Facebook, Wikipedia, Pinterest, GitHub, StackOverflow, and many others.
You can find more on that here: What is Redis Object Caching and How to Use It for Your WordPress Site, and Memcached: What Is It and How to Use It on Your WordPress Site?
4. Include Opcode Caching
OPCache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.
In other words, Opcode caching compiles PHP code between each request from the database.
PHP executes by first compiling code, which is done by the PHP compiler. Then, executable code is generated that the server understands and can execute.
Opcode caching factors in at this point by caching the code that has been already compiled. That way, future requests are pulled from the cache instead of the database to free up resources.
Fewer requests to the database mean less data that the site has to load which leads to faster loading times.
It’s helpful to include in your strategy to cache WooCommerce and WordPress because they’re primarily built on PHP, which is what OPcode caching, well, caches.
5. Setup Varnish Cache
An HTTP reverse proxy exists between the server and the user. It filters requests and can be used for caching.
It also has other benefits including enhanced security, GZIP compression, and more.
6. Reduce or Cache API Calls
If you use a lot of plugins that require your site to make third-party API calls, you may start to notice your site getting sluggish.
For example, if you display a Twitter, Facebook, or Instagram feed on every page, it can really get costly when it comes to speed.
While you may need to use some of these plugins, you can remove the ones you don’t really need, or reduce the amount you use them if possible.
Instead of displaying your social media feeds on every page such as in the footer, you could move it to display only on your homepage. Even though you’re not getting rid of the API calls completely, reducing the amount can help dramatically speed up web page loading times.
In most cases, you can also safely cache API calls with the WordPress Transients API.
You can check out The Complete Guide to the WordPress Transients API for details.
7. Optimize Your Code While You Cache WooCommerce
While you have set out to cache WooCommerce in ways you may not have considered previously, you may as well also boost your site’s speed in other ways such as minifying scripts and optimizing your CSS and JS files.
It’s one additional option that really packs a punch.
Once you have effortlessly installed it as you would for most other WordPress plugins, go to Settings > WP Rocket in the WordPress admin dashboard.
Next, click on the File Optimization tab on the page. You’ll find all the options to optimize your code at its best.
These are the features to tackle CSS files, from modification to Optimize CSS delivery:
What’s more, you can quickly reverse any changes with WP Rocket!
To do this, first, disable the option that caused the error. Then, clear the cache using that option under the Quick Actions section on the Settings > WP Rocket > Dashboard page.
Cache WooCommerce for Top Page Speeds
There isn’t just one way to cache WooCommerce to speed up your site’s page load times. There are several ways and they’re often forgotten.
With these tips and with the help of WP Rocket, you’re well on your way to having a speedy store that your customers will love to shop. Keep in mind that the right caching plugin for your WooCommerce site can make a big difference in performance!
How do you plan to cache WooCommerce to speed up your store? What has been the most successful form of caching for your site? Share your experience in the comments below.