Advanced Settings

There are a few advanced settings located within the Intelligems app. This article will walk you through what those are, and how to set them up.

Intercept ATC XHR​

By default, this is turned on to correctly change your prices using checkout scripts. When a user presses 'Add to Cart' with this setting on, the XHR script sent from the site to Shopify is intercepted and modified by Intelligems before sending to Shopify.

Currency Format​

Specifies format for how currencies are displayed on your website. When editing this field, make sure to press 'Validate' before pressing Save Configurations.

Currency Format Structure:

{
    "options": {
      "localeMatcher": "string",
      "style": "string",
      "currency": "string",
      "currencyDisplay": "string",
      "currencySign": "string",
      "useGrouping": boolean,
      "minimumIntegerDigits": number,
      "minimumFractionDigits": number,
      "maximumFractionDigits": number,
      "minimumSignificantDigits": number,
      "maximumSignificantDigits": number,
    }, 
    "symbol": "string",
    "suffix": "string",
    "removeTrailingZeros": boolean,
}

Currency Format Example

{
    "options": {
        "minimumFractionDigits": 0,
    }, 
  "symbol": "$",
  "suffix": " USD",
}

See documentation here for more information on the options object.

Currency Function​

Specifies which currency function to use when adding our prices to your site. If you use a standard formatMoney function in your window.theme object (i.e. window.theme.Currency.formatMoney), you can insert that into this field like this: window.theme.Currency.formatMoney. You can also create a custom formatMoney function in your theme.liquid file.

Custom Currency Function

<head>
    ...
    <script>
        try {
          window.igCurrencyFn = (price) => {
            let code = "USD";
            const value = `; ${document.cookie}`;
            const parts = value.split(`; cart_currency=`);
            if (parts.length === 2) {
              code = parts.pop().split(";").shift();
            }
    
            const formatter = new Intl.NumberFormat("en-US", {
              style: "currency",
              currency: code,
            });
    
            return `<span class=money>${formatter.format(price/100)} ${code} </span>`;
          };
        } catch (error) {
          console.log(error);
        }
    </script>
    ...
</head>

\

Last updated

Was this helpful?