How to get correct currency rate (Presentment Currency Rate)

Shopify Partner
14 2 6

Hello. Can you please advise on a method to obtain the exchange rate of the local currency relative to the base currency on the frontend? For instance, I have a discount value in the base currency stored in the product's meta field. I need to convert this value to the local currency, considering the current exchange rate, rounding, and any fees associated with the exchange (which are configured in the marketplace).


I can be more specific. This value should precisely correspond to the presentmentCurrencyRate used in the discount function extension for Cart Input:


/** The input object for the function. */
export type Input = {
__typename?: 'Input';
/** The cart. */
cart: Cart;
/** The discount node executing the function. */
discountNode: DiscountNode;
/** The localization of the Function execution context. */
localization: Localization;
/** The conversion rate between the shop's currency and the currency of the cart. */
presentmentCurrencyRate: Scalars['Decimal'];
/** Information about the shop. */
shop: Shop;



Replies 2 (2)

Shopify Staff
2731 302 777

Hi Dante,

Does the native way to support multiple currencies and languages in Shopify themes not fit your use case? If not, one option would be to make a call to a currency exchange API and once you have the exchange rate, you can convert the discount value from the base currency to the local currency. You can write a JavaScript function that takes the base discount value, exchange rate, and fees as inputs and returns the converted value. This function can be called on the frontend wherever the converted discount value needs to be displayed.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
268 13 75

If you're using JS on the Online Store, you can use `parseFloat(window.Shopify.currency.rate)`.