WooCommece: Caching Types and Recommended Settings

I’ll start by explaining the basics and what the term “cache” and “caching” means. You should have an understanding of what cache is before you enabled it on your WordPress/WooCommerce site!

Table of Content:

What is caching?

Caching is a method of speeding up your website by “saving” a copy of the information that has already been created once. You can think of it caching as a “screenshot” of information.

In simple terms: Your server and database perform a lot of quires to create each HTML page every time someone visits the page. Page caching will save the HTML as “cache”, then display the cached page when someone visits your site. Your website will load a lot after because the HTML has already been created, it just needs to be displayed.

Caching parts of your website will help improve load time, usability and having a fast site is a ranking factor for SEO. However, you need to carefully select and choose what type of caching you use on your WooCommerce store. Each site has different requirements that should be taken into consideration. The cache can also introduce a wide range of problems if the setup is incorrect.

What types of caching are available?

1. Page Caching

Page caching is the most common form of catching. Page cache involves storing the entire HTML of a page after it’s been created. Your visitors will be shown the cached HTML quickly, rather than re-creating the page for each page load.

Requirement:

You can set up Page Cache quickly using a variety of server caching options, and caching plugins for WordPress.

We personally use Kinsta Cache which is included in our hosting. WPRocket is also a popular option.

2. Object Caching

Object caching involves storing database queries so that the next time a piece of data is needed, it is delivered from the cache without having to query the database. Object caching can greatly improve the speed of WooCommerce sites.

Requirement:

Object caching is recommended for larger WordPress & WooCommerce sites. You will need additional server tools and plugins like Redis and Memcached.

3. Opcode Caching

OPcache is a caching engine built into PHP. When enabled, it dramatically increases the performance of WordPress. You do not need to do anything, as this is likely already enabled by your hosting provider.

Requirement:

You don’t need to do anything, as OPcache is likely already enabled by your hosting provider.

4. CDN Caching

Content delivery networks (CDNs) use edge servers around the world to store static website files such as CSS, JavaScript, videos, and images. CDNs will load the site files from a server that’s geographically close to the visitor.

Requirement:

You will need to use a CDN provider like Cloudflare or BunnyCDN.

5. Browser Caching

The internet browsers may cache files and cookies related to the site as well. Your site will appear faster because the browser will load some files directly from the hard drive, rather than waiting on the re-fetching the files from the website server again.

Requirement:

Browser Caching will happen automatically as the visitors browse your site. However, you can control how the browser should cache files using Expiry Headers.

What are the side effects of caching?

I need you to know that caching is not a magic solution to fix a slow site, and caching should be handled/tested with care when you are using it with a WooCommerce site.

As explained above caching is information that has been saved to speed up the next page load. If the site is static this is great, but remember WooCommerce has personalized pages, such as the cart, checkout, account pages. If you do not set up your caching solution to correctly bypass the cache for specific situations then you could be showing the wrong content to the wrong visitors.

Each caching tool does have its own cache exclusions and settings. I recommend reading their documentation and testing each cache tool thoroughly before you use it in production.

Recommend cache settings for WooCommere

Keep in mind that each solution is different, therefore I cannot cover each caching tool and plugin.

These are my recommended settings to check within a caching plugin:

  • Bypass cache on cookie woocommerce_items_in_cart
  • Bypass cache for all logged-in users.
  • Bypass cache on query strings. (any URL with /?)
  • Bypass cache for the following urls
    • /wp-admin/
    • /wp-login.php
    • /checkout/
    • /cart/
    • /my-account/
    • /wp-json/
  • Purge cache on post/product update.
  • Purge cache on plugin install
  • Purge cache on plugin update

Are you experiencing weird WooCommerce issues? It could be related to cache. We’ve written a guide to help you identify and fix common WooCommerce cache issues.

Selecting Cache Compatible Plugins

Simple plugins that make minor changes to the site should be fine, however, you should check with the developers when a plugin use custom database tables or queries

Let’s talk about our Reserved Stock Pro (RSP) as an example. RSP is built to handle reservations on large WooCommerce sites and therefore also support object caching using WP_Object_Cache. This method of caching on database queries from plugins allows your server to stay speedy without breaking down when your customers are trying to purchase.

Remember, not all plugins are coded equally. Therefore it’s important to check with the developers if your chosen plugins will work with your cache setup.

Avatar photo
Morgan

I help eCommerce store owners to run their stores smoothly and get more sales. Let's discuss optimizing your store! Hit me up via the support page or on Twitter @morganhvidt

Leave a Reply

Your email address will not be published. Required fields are marked *