Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
We have a website with several markets, using various currencies, and we use the Bespoke Shipping app to calculate postage charges.
I have written some Liquid / JavaScript code on our Product page to query the Bespoke Shipping API and retrieve the cost to ship that product to the country of the market the user has connected from, and display it on the page. This works fine for our default market (UK) as the shipping rates are always returned in GBP. I now need to convert them to the currency of the market. I initially tried using the /services/javascripts/currencies.js script (then rounding, as per the settings of the relevant market) and it works for some markets - the shipping cost I display on the product page matches the shipping cost shown at checkout. For other Markets, it fails (Australia, for example, shows $19.00 on the Product page, and $20.00 on the Checkout page).
I'm pretty sure this is due to the currency conversion of the /services/javascripts/currencies.js script not using the same rates as Shopify's internal systems, as used on the Checkout page (we have a widget on the Shopping Cart page that shows an unrounded shipping rate, and for Australia this is $19.08 which would, indeed, get rounded up to $20.00).
Is there a way to get my JavaScript to use the same currency conversion rates as the Checkout? I just spent three hours with ChatGPT going back and forth, tweaking different things, even creating an app to use the Storefront API, before it decided to mention that none of this would work because "Shopify doesn't expose its internal currency conversion rates"!!!
Any help would be most gratefully received.
(Apologies if I have posted in the wrong location)
Hi!
I have same problem. Did you find any solution?