DocumentationAPI Reference
Documentation

Localize Javascript helper methods

The Reach Localize App has some JavaScript helpers methods that can be used to enhance functionality on your store. The table below consist of those helpers and what they do.

FunctionNotes
GIP.forceUpdate()Reconvert prices as soon as possible. Can be used when any custom scripts update prices and you want to minimize the time to reconvert, since normally prices convert on an interval basis.
GIP.resetCalculatedCartTotals() Hides any unconverted cart prices. Can be used when any custom scripts update prices and you want to minimize the price flicker of unconverted prices. This can be used in conjunction with GIP.forceUpdate() by calling GIP.resetCalculatedCartTotals() before.
GIP.selectCurrency() Changes the conversion currency. Can be used when the merchant wants a custom currency switcher rather than using the currency selector dropdown that's built in.
GIP.currencyFormats() Helper function that outputs all the currency formats in the console.
GIP.getLocalizeData() Returns a promise which will be resolved with localize data when a rate offer is retrieved. If no rate offer is available, it will resolve to false. See usage notes below.

How to use GIP.getlocalizeData

GIP.getLocalizeData().then(function (data) {
    if (data) {
        console.log(data);
    } else {
        console.log('No rate offer available.');
    }
});

Testing Currencies without using a VPN

While using a VPN creates the best customer scenario for testing your store in multiple currency. the selectCurrency helper allows you do this also via the console

  1. Right Click on your Store page and click inspect
  2. Click on the Console Tab
  3. Use the selectCurrency helper with the currency code you wish to test e.g. GIP.selectCurrency("EUR")
  4. Press Enter

Your store page should refresh and prices should be displayed in the new currency.

1688