WpW: LSCache + WooCommerce For a Super Speedy Shop!
Welcome to another installment of WordPress Wednesday!
Did you know that LiteSpeed Cache is compatible with WooCommerce? LSCache has built-in logic to handle everything WooCommerce determines to be cacheable, which makes a separate WooCommerce caching plugin unnecessary!
Here are some of the features of LSCache that make a pairing with WooCommerce so sweet:
For starters, if WooCommerce says something is cacheable, then LSCache will cache it. Alternately, if WooCommerce doesn’t want something cached (like, for instance, the Cart, My Account, and Checkout), LiteSpeed will automatically respect that, and will not cache those pages. There’s no extra configuration required.
If your stock is managed by WooCommerce, then product pages can be purged from the cache whenever the stock changes (whether this is at checkout or by an administrator at the wp-admin Dashboard).
Additionally, with our “smart purge” technology, when a product page is purged (for whatever reason), the related category and tag pages can also be purged from the cache, this way you never have outdated product information showing anywhere on your site. This is a big advantage of LiteSpeed Cache. Other plugins struggle with purging related category pages, because they don’t have a cache tagging system like ours.
For more control, you can set your caching preferences, in LSCache’s WooCommerce Configurations tab.
Set your preferred caching interval based on your store’s configuration. For instance, if you display your stock figures on the product or category pages, you will probably want to purge the product and the related categories any time someone buys one of those products, like in the example below. On the other hand, maybe you don’t display your stock anywhere. In that case, you may want to keep your store mostly-cached with a long TTL, and only purge the relevant pages when a product becomes completely unavailable. It’s your choice.
Let’s say there’s a product in your shop called Rainbow Crayons. You have 10 boxes of them in stock, and your product page displays this. Now you’ve sold a box. When the customer checked-out, that Rainbow Crayons page was purged from your cache, because the quantity in stock changed from 10 to 9. The next visitor to Rainbow Crayons would get a fresh copy of the page, and it would display 9 boxes in stock.
If your category and tag pages also show stock information, presumably you’d want fresh copies of the Crayons category page, and the Rainbow tag page as well. To make this happen, you’d configure LSCache to purge relevant categories and tags whenever a product page is purged. The next customer to visit those pages would see that you now have 9 boxes of Rainbow Crayons in stock.
So, this is all pretty cool, don’t you think? With LiteSpeed, your WooCommerce shop cache will be kept as fresh as possible, and your customers will always see the most up-to-date information in your product, category, and tag pages.
LSCache does all of this, and is still fully functional on the rest of your WordPress site, too
Coming Soon: We’re working on a new version of LSCache for WordPress that will support Edge Side Includes (aka ESI). This means that you’ll be able to cache a whole page publicly, while punching holes in that page for private data (like shopping cart information, for instance, or a personalized welcome message). Keep an eye out for that exciting development soon!
As you can see, LSCache and WooCommerce make a nice pair. In most cases, they are compatible right out of the box. And for the few cases where they are not? Well that’s what WordPress Wednesday is for! Join us back here next week where we’ll give you an easy fix for a LSCache/WooCommerce cart conflict that occurs in some WooCommerce themes.
Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!
Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:
- Subscribe to the WordPress Wednesday RSS feed
- Download LiteSpeed Cache for WordPress plugin
- Learn more about the plugin on our website