Access currency rate from Liquid

Hey there,

I know we can access current storefront currency rate with Shopify.currency.rate but is there a way to access it from Liquid?

Thanks for your help

1 Like

You could store them in cart attributes and remove them when you no longer need to use them.

:wave: there is a liquid drop for currency – does this work for your use case?

Doesn’t look like to have currency rate

This is what I need:

Yeah you can get that on first page load then throw it into cart attributes and then use it in Liquid via the Section Rendering API, or pulling the page again and replacing the view, etc.

You just cannot get it on initial load via Liquid because it’s not there.

Just remember to remove from cart attributes when you no longer need to use it or it will show in the order page of the admin back-end.

Mhh I don’t need all of that, I can just use JS instead but I wanted a straight solution using Liquid but maybe there’s none :man_shrugging:

If something from the team is around, could be good to have that in the future

Makes sense to go that route. Usually people want it in Liquid to process things outside of the client-side so that is why I shared some suggestions on what to do to make that happen.

Liquid needs to be predictable so that is why randomness is not part of it. With exchange rates, I am guessing the same restriction applies so we likely will not see them natively in Liquid.