Shopify: Fix leverage Browser caching
Whether you're a merchant or a developer, you're likely an avid for speed optimization – after all it is one of the not so mere details that do play an important role on any website, especially the e-commerce ones.
Although Shopify does not allow any customization to be done on the server, you can still leverage browser caching on the client-side, within your theme.
Adding the code to your theme
- In your Shopify Admin go to online store > themes > actions > edit code
- In your theme.liquid file, find the <head> (press CTRL + F or command + F on Mac)
- paste this code right below the <head> tag:
<meta http-equiv="Expires" content="30" />
- Save.
That is it! The meta data above means that document is considered expired after the specified date and time. If you set it to “0“, the browser will check for a fresh new document on each visit, which can potentially add some extra loading time to your website.
Was this article helpful?