Jump to content

How to force browsers to show updated prices?

Recommended Posts

Site URL: https://www.whitprint.com/emprex-22-inv

7.0/Montauk

We have a product page whose prices are updated every morning (which we do by importing inventory from a .csv file). Our shoppers visit the page every day. A couple of shoppers have told us that when they open the page in their browser they see yesterday's prices until they refresh the page after it has loaded. One shoppers asserts that this happened even though he'd closed the page the previous day.

This sounds to me like browsers are fetching day-old content from cache. Is this what's happening?

More importantly, is there anything we can do on our site to prevent browsers from fetching cached content when reopening this page?

We could have our page display "Refresh for current prices!" but that seems lame. Also, we didn't get any complaints about stale prices in previous years. (This is the third year we've run this product campaign.) Maybe this year's shoppers are just fussier, or maybe ... something has changed in Squarespace?

ps: Wow, you hit Return at the wrong time and suddenly you've already posted your question! Anyway, I just wanted to add that I first posted this in Commerce but it occurs to me that maybe there's some coding that would solve this problem. If I don't get any suggestions soon I'm going to have to add the "Refresh for current prices!" to our page. ☹️

Edited by LKW
Hit return too soon!
Link to comment
Quote

This sounds to me like browsers are fetching day-old content from cache. Is this what's happening?

This is certainly a possibility. It could also be happening further up the chain.

You can try adding the following to Store Settings > Advanced > Page Header Code Injection for the store page. Please see per-page code injection.

<meta http-equiv="expires" content="0">

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 9/7/2022 at 10:30 PM, creedon said:

You can try adding the following to Store Settings > Advanced > Page Header Code Injection for the store page. Please see per-page code injection.

<meta http-equiv="expires" content="0">

Let us know how it goes.

Thank you for the tip! But, sadly, it seems to have made no difference.

And then I found this dispiriting info (which I suspect you authored):
https://sf.digital/squarespace-solutions/why-doesnt-my-code-work-until-i-refresh-the-page
from which I infer that the only remedy is the site-wide removal Ajax page load optimization. Our site is so teeny this might be feasible, except that we have lots of huge images (e.g., 171 on the product page in question) and I worry that they would be reloaded unnecessarily.

So, we're going with the jenky "Refresh page for latest stats!" text. Sigh...

Link to comment
Quote

And then I found this dispiriting info (which I suspect you authored):
https://sf.digital/squarespace-solutions/why-doesnt-my-code-work-until-i-refresh-the-page

That is @paul2009's work.

Quote

I infer that the only remedy is the site-wide removal Ajax page load optimization.

I suggest turning it off short term to see if that solves the issue.

Quote

except that we have lots of huge images (e.g., 171 on the product page in question) and I worry that they would be reloaded unnecessarily.

I think Ajax doesn't help with images. It is designed to reduce the number of times structural elements, like the site header, are reloaded. The browser handles the caching of media, like images.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
51 minutes ago, LKW said:

I found this...from which I infer that the only remedy is the site-wide removal Ajax page load optimization.

If you're using a Montauk family template, it doesn't have this feature 🙂

Edited by paul2009

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
23 hours ago, LKW said:

@creedon This morning I did get a refreshed page when I reopened it in my test browser after updating prices, so perhaps the "expires" tag is working after all.

But not in all browsers. It's now refreshing on reload in Safari, but not in Chrome or Firefox.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.