Zonos logo
DOCS

Currency conversion

/

Currency conversion 

SKILLS NEEDED : Advanced developer skills

You can provide Zonos Hello with the CSS selectors for the price elements on your site. Zonos Hello will take the text of the elements and use foreign exchange rates to convert them to display the foreign currency. You can pass the CSS selectors into config with the currencySelectors property.\

Hello integration script

1
zonos.config({currencySelectors: '.money, .price, #subtotal'});

You can re-trigger the currency conversion by calling the following JavaScript:

Hello integration script

zonos.displayCurrency();

Calling displayCurrency may be needed if your site is loading product information dynamically after the page has loaded.

If further customization is needed, you can provide a custom converter. The converter should be a Javascript function that takes three arguments.

  1. A function that takes a number and returns a string with the converted price formatted for display.
  2. A function that takes a number and returns the converted price as a number.
  3. A function that takes a number in the foreign currency and returns a string formatted for display.
zonos.config({
  currencyConverter: (convertAndFormat, convert, format) => {
    // a price from your page
    const price = 12.34;

    // a formatted string (ie "CA$17.60")
    const displayPrice = convertAndFormat(price);

    // a number (ie. 17.6)
    const foreignPrice = convert(price);

    // a formatted string (ie "CA$17.60")
    const displayPriceAgain = format(foreignPrice);
    }

});

Next steps

  • Hello settings - Easily configure Hello settings, including enabled countries, site placement, and more.
  • Zonos Landed Cost - Need duty and tax calculations at checkout? Learn how you can get automated landed cost for your business.
  • Zonos Checkout - Learn about the best international checkout to simplify the cross-border buying experience.

Related Decoder Guides

FAQ

I'm not a developer and need assistance. What are my options?

Zonos offers custom development work at an additional cost. Pricing depends on the amount of work requested.

On this page: