Dan   

Opencart is a popular opensource eCommerce platform written in php. We recently onboarded a client that had several opencart stores suffering from performance issues. Full page caching for Opencart was an obvious solution to alleviate their page load times, which were often 10+s. The Peakhour way is for the client to get the maximum benefit from our service. That meant writing an Opencart plugin that lets Peakhour know when specific content has changed. That way we can have long lived caching of dynamic content, combined with targeted flushing when that content changes.

The Peakhour plugin is based on LiteSpeed's plugin for their webserver. It is a simple install and provides the following features:

Tag Based Flushing

Each page returned by opencart has an X-Opencart-Tag header that has the categories and products listed on the page, this information is recorded in the Peakhour cache as meta data. When a product or category is updated, then Opencart issues a flush with the relevant ID. Only the pages that have that ID are refreshed.

Opencart 3 full page caching headers Headers returned by caching plugin.

Custom TTL

TTL (Time to live) is the amount of time a resource lives in a cache before the cache will check for a new version, you can control this within the plugin.

Ajax Mini Cart, WishList

Mini carts and wishlists are dynamic sections of webpages that prevent caching. The Peakhour plugin makes these load via Ajax so the maximum amount of pages cacheable.

Cache vary on Logged in user, Currency, Language

The same page can present different information depending on whether a user is logged in or not, the store is multicurrency and the currency changes, or a different language is selected. The Peakhour Opencart plugin caters for this by changing a cookie value when these change and makes separate cache regions for the different possibilities.

The Results

The Peakhour Opencart plugin effectively makes the Opencart platform as cache friendly as Magento 2 or Drupal 8, maybe even more so. Our client has dramatically improved their webvitals scores (full case study to come) and the scalability of their website. Check out their LCP for the last few months, hint full page caching was enabled in October.

Opencart 3 web vitals improvement Full page caching was enabled in October. Note a significant amount of pages, eg checkout, admin etc cannot be cached which affects these stats

Grabbing the plugin

Check out our plugin page or contact us for more information!

Website Performance Opencart 3 Plugins