How to get consistent exchange rates that work with Hydrogen

Ideally, you shouldn’t be using JavaScript to calculate your final price after currency conversion. Like you say, currency exchange rate are changing daily and we shouldn’t have discrepancies between displayed price and the prices show up in checkout.

A different approach to this is using MetaObjects. For example, you have a MetaObject with data type Money

Then create an entry under that MetaObject description with an amount. This is usually set to your shop base currency.

Use SFAPI query for that MetaObject. If you add inContext for a supported country currency that your shop has, it will return the Money amount in the currency that you specified in the inContext.

1 Like