Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
If a product page is viewed / refreshed fairly heavily, it moves into a Shopify storefront cache layer.
Once in the cache, it doesn't refresh data - for example, the liquid variable for the current store time.
We are using this liquid time variable to understand if a product should be made available for pre-order on the store.
The only reliable method we've identified to clear storefront cache for a product page is to use the Shopify Admin and manually make a change to the product there.
We've tried using an automated API update of product data to see if making a change will force a refresh of the cache - but via the API, it doesn't appear it clears the cache.
Does anyone have any experience of cache busting a partucular page via the API or have any clever workarounds?
Does anyone know of any approaches that will reliably clear the Shopify storefront cache for a product page?
An alternative idea for now, what if you created a JavaScript function that executes on pageload and checks the time you have showing, verifies it, and updates it if it's different?
You could also use setInterval() to check every minute in case they have the page open and time passes... though if it's just a date in the future that may not apply here.
Hi @JoesIdeas I dislike the client polling concept in general because it doesn't scale and so if there is a high traffic event - there's a server that will be receiving a hammering 🙂 Some sort of backend ajax check may be th only way through here though - but again, it's really not the approach I want to take.
But it doesn't look like we have a way to bust the API in a controlled way. I was hoping the group mind of Community forums might come up with a way to do this - but I fear from the responses so far, it's not possible.
I hear ya on the polling, that might just be an assumption you have about not scaling based on other experiences (like having a single server without much bandwidth, rather than a CDN and distributed server load), I haven't witnessed a scale problem and I've seen 3rd party apps polling... but ya not a root fix just an idea for a temporary workaround.
Tough one to solve the best way without Shopify's help on controlling that cache, good luck I hope you find a good solution.
Interesting - I'm also curious about this. From a quick search it doesn't seem to be possible to clear the cache automatically.
I will continue to search - a controlled API method to bust a cache on a product page would be extremely useful in my use case, and I'm sure in others.
An admin product save does indeed bust the cache in this way - so there must be a process that carries this out - but it's not exposed to the API.
How exactly are you using the store time liquid variable to determine whether the product should be available for pre-order or not? I wonder if there is another solution to this problem.
Esentially on page 'load' we use the Liquid variable for current time. (I apologise for not having the exact variable used to hand.) We then use this to determin the output of whether the button is active as a pre-order or inactive.
I want this logic to be based on server time - not local user time to prevent easy spoofing.
Another way to think about it. In your links to your pages, from navigation, internal etc, you can add a ?id=random-number so that cache is forced to refreshed every new id
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025