How to Match Shopify's Exchange Rates and Retrieve Products with Country-Specific Pricing via GraphQL

Hello,

I would like to know how I can retrieve the exact same exchange rates that Shopify uses for currency conversion across different countries. Is there a way to access or replicate these rates through the Shopify API?

Additionally, I am using the Storefront GraphQL API and would like to fetch products based on a specific country code. My goal is to have the returned product prices reflect the converted amounts using the same exchange rates Shopify applies.

Is this achievable through the API, and if so, what would be the best approach to ensure consistency with Shopify’s pricing logic?

Thank you in advance for your guidance.

Best regards,
Toan

Hi, I think Shopify does not provide direct access to the exact exchange rates it uses via any of its APIs.

However, there’s a useful workaround that can help you replicate the effective exchange rate on the storefront side:

  1. Create a shop-level metafield of type money (e.g., custom.exchange_base) and assign it a static value of 1.00.
  2. When queried via Storefront API in a specific customer context (i.e., with a different country or currency), Shopify will return the converted value of that metafield according to the active exchange rate.

For example, if the shop currency is PLN and a user from the US is browsing, querying the custom.exchange_base metafield will return the equivalent of 1 PLN in USD - effectively giving you the exchange rate.

2 Likes

Hi Toan, you shouldn’t need to worry about the FX rate that is being used, you only need to worry about the resolved value for each country. If you’re using the Storefront API, inContext directive gives you this: Storefront API reference

If you still think you need to know what the FX rate is, I’d love to know more about the use case, but this is not something we expose.

1 Like