Retrieving Store Time Zone Via Liquid or Javascript

Retrieving Store Time Zone Via Liquid or Javascript

Jay_JUNKbrands
Shopify Partner
7 1 2

Has anyone figured out how to get the store's specified time zone in either liquid or javascript? I'm aware of the date filter, but not sure if this reports the time based on the client's browser or based on the store's locale...

 

{{ "now" | date: "%Y-%m-%d %H:%M" }}

 

I don't have a VPN that I can use to test it out from another country, so I'm asking for a friend here, lol. Thanks!

Replies 4 (4)

LitExtension
Shopify Partner
4915 1005 1183

Hi @Jay_JUNKbrands,

The value will be the current time of when the page was last generated from the template, not when the page is presented to a user if caching or static site generation is involved.

So it will show the store's timezone, not that client's browser.

Hope it is clear to you.

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
Jay_JUNKbrands
Shopify Partner
7 1 2

Thank you so much for your help! I think I mostly understand what you're saying.

 

Would you happen to have any idea what triggers cause the page to be "generated from the template"? For example: Daily? Or only when the theme settings are saved?

LitExtension
Shopify Partner
4915 1005 1183

Hi @Jay_JUNKbrands,

It is when you change the timezone in admin settings. Now will show according to Time zone, you can change and check it yourself 🙂

Hope it is clear to you.

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

 

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
Contact us:
- Email: contact@litextension.com
ahmadamjad09
Shopify Partner
3 0 2

I am facing same issue, timezone which I am retrieving by shop Admin API is different from the time zone that is showing in store detail