Articles on: Currency Converter

๐Ÿงฉ Developer Guide โ€“ Make Your App Compatible with Hoppy Currency Converter

This guide is for developers of other Shopify apps (upsells, bundles, reviews, cart drawers, page builders, and so on) and for theme developers whose prices should follow the shopper's selected currency.


If your app or theme section shows prices on a store where Hoppy Currency Converter is installed, this page explains how to make those prices convert. The options are ordered from no work at all to full control.


Merchants: if another app's prices aren't converting on your store, share this page with that app's developers or with your own developer. Most integrations take fewer than 20 lines of code.



โšก The Short Version


  • You render prices as HTML โ†’ wrap them in the shop's money format (<span class="money">โ€ฆ</span>). We convert them automatically. Nothing else to do.
  • You calculate prices in JavaScript โ†’ read Shopify.currency.rate and listen for the futureblink:currencychange event.
  • You want us to do the math and formatting โ†’ call window.futureBlink_convertAmount(amount, fromCurrency).
  • Your app runs inside an iframe โ†’ use our postMessage bridge.
  • You can't change any code โ†’ the merchant can add your price element in our app under Advanced โ†’ Custom Price Selectors.



๐Ÿ” How the Converter Works


When a shopper picks a currency, one of two things happens:


Markets mode


If the currency is enabled in the merchant's Shopify Markets, we switch currency through Shopify's native /localization endpoint. The page reloads and Shopify converts everything itself, including checkout, and keeps Shopify.currency up to date. Your app behaves exactly as it would on any multi-currency Shopify store.


JS mode


For currencies that are not enabled in Markets, we convert prices in the browser:


  • We rewrite every element that matches the shop's price selectors (.money, .price-item, plus any custom selectors the merchant added)
  • We keep Shopify.currency updated with the active currency and rate
  • We fire a DOM event on every currency switch
  • A MutationObserver catches prices your app adds after page load (popups, offers, drawers) and converts them within about 200 ms



โœ… Option A โ€” Use the Shop's Money Format (Recommended)


This needs no integration code. Render your prices with the merchant's own money format HTML, the same markup the theme uses:


<span class="money">$19.99 USD</span>


That's it. We treat these elements exactly like theme prices: they convert on page load, on every currency switch, and when your app adds them later.


This is the convention most apps follow, so it also makes your app compatible with other currency converters, not only ours.


โš ๏ธ Important:


Render the amount in the store currency, in the shop's money format. Don't convert it or apply your own separators. We handle the target currency's symbol, separators and rounding according to the merchant's settings.



๐Ÿงฎ Option B โ€” Read Shopify.currency and Listen for Changes


Use this when you calculate prices in JavaScript (discounts, bundle totals, dynamic offers).


We keep the standard Shopify.currency object updated, the same object Shopify maintains in Markets mode, so one code path works for both modes:


function toDisplayPrice(amountInStoreCurrency) {
const curr = window.Shopify?.currency;
const rate = parseFloat(curr?.rate || 1);
const converted = amountInStoreCurrency * rate;
return converted.toFixed(2) + " " + (curr?.active || "");
}


Shopify.currency.rate is a string holding the raw multiplier from store currency to the active currency. Apply your own formatting and rounding on top, exactly as you would with native Shopify Markets.


Re-render when the currency changes


document.addEventListener("futureblink:currencychange", (event) => {
// event.detail = { currency: "EUR", rate: 0.92, source: "select" | "instant" }
renderAllPrices();
});


  • source: "instant" fires during page load, when the shopper's saved currency is restored
  • source: "select" fires when the shopper switches currency
  • rate can be null if rates haven't loaded yet. Read Shopify.currency.rate instead of relying on it


In Markets mode the page reloads on every switch, so no event fires. Read Shopify.currency fresh on each page load (Shopify sets it).


If our app isn't installed, Shopify.currency is Shopify's own object (store currency, rate 1.0), so the same code still works.



๐Ÿ”„ Option C โ€” Let Us Convert with futureBlink_convertAmount


Use this when you don't want to handle rates or formatting at all:


if (typeof window.futureBlink_convertAmount === "function") {
const display = window.futureBlink_convertAmount(19.99, "USD");
// e.g. "โ‚ฌ18.40 EUR", converted, rounded and formatted per the merchant's settings
el.textContent = display ?? "$19.99 USD";
} else {
el.textContent = "$19.99 USD"; // fallback: converter not installed
}


Signature


futureBlink_convertAmount(amount, fromCurrency?, options?) โ†’ string | null


  • amount (number or string): the amount in fromCurrency
  • fromCurrency (string, optional): ISO currency code. Defaults to the store currency
  • options.toCurrency (string, optional): defaults to the shopper's active currency


Return value


A fully formatted string, with symbol, separators, the merchant's rounding and currency code settings applied.


It returns null if exchange rates haven't loaded yet or the amount isn't a number. Always fall back to the unconverted price when you get null.


The conversion follows the merchant's manual exchange rates when they've set any, so your price matches ours to the cent.


Combine it with the futureblink:currencychange event from Option B to re-render on every switch.



๐ŸชŸ Option D โ€” Your App Runs in an iframe


DOM-based conversion can't reach inside iframes, so we run a postMessage bridge on the storefront:


// inside your iframe
const NAMESPACE = "futureblink";

// 1) Handshake: learn the active currency
window.parent.postMessage(
{ namespace: NAMESPACE, type: "fb:currency-converter:hello", app: "futureblink-yourapp" },
"*",
);

// 2) Convert individual amounts
window.parent.postMessage(
{ namespace: NAMESPACE, type: "fb:currency-converter:convert",
app: "futureblink-yourapp", id: "price-1", amount: 19.99, fromCurrency: "USD" },
"*",
);

window.addEventListener("message", (e) => {
const m = e.data;
if (!m || m.namespace !== NAMESPACE) return;
if (m.type === "fb:currency-converter:hello-ack") {
// { active, currentCurrency, storeCurrency, primaryCurrency }
}
if (m.type === "fb:currency-converter:converted") {
// { id, converted, fromCurrency, toCurrency }; converted is a formatted string or null
}
if (m.type === "fb:currency-converter:currency-changed") {
// shopper switched currency, so re-render; { currentCurrency, storeCurrency }
}
});


โš ๏ธ Important:


Every message must include an app field that starts with futureblink-, or the bridge ignores it. If you're building a third-party app and need iframe access, contact our support team and we'll allow your app's prefix.



๐Ÿ•ต๏ธ Detecting Our App


Some apps keep a list of currency converters they support, for example to decide whether to render money-format markup. Our globals are:


window.futureBlink_convertorData // present on every page where our app embed is enabled
// (converter settings object, or null)
window.futureBlink_convertAmount // function, present once the converter has initialized


  • Check futureBlink_convertorData to know the converter is installed
  • Check futureBlink_convertAmount to know the converter is ready to convert amounts



๐Ÿงญ Which Option Should You Pick?


  • You render prices as HTML โ†’ Option A, the shop's money format. Done.
  • You calculate prices or discounts in JavaScript โ†’ Option B, Shopify.currency.rate plus the event
  • You want the merchant's rounding and formatting applied โ†’ Option C, futureBlink_convertAmount
  • Your app runs inside an iframe โ†’ Option D, the postMessage bridge
  • You can't change your code โ†’ the merchant adds your price element under Advanced โ†’ Custom Price Selectors (see our guide on setting up a Custom Pricing Selector)


You can combine options. A common pair is Option A for static prices and Option B for calculated totals.



๐Ÿงช Testing Your Integration


โ†’ Install both apps on a Shopify development store
โ†’ In the Currency Converter widget, switch to a currency that is not enabled in the store's Shopify Markets (this uses JS mode)
โ†’ Reload the storefront and check that your prices convert on load
โ†’ Switch currency again and check that your prices update (through the observer for Option A, or your event handler for Options B and C)
โ†’ Trigger your app's dynamic UI (popup, drawer, injected offer) and check that prices convert within about 200 ms
โ†’ In the browser console, check that Shopify.currency shows the active currency and a rate matching your selection



๐Ÿ†˜ Need Help?


We're happy to provide a test store, review your integration, or allow your iframe app's prefix.


โ†’ Contact our support team


Include:


  • Your app's name
  • The store URL where you're testing
  • Which option you're using and what isn't working



๐ŸŽ‰ Final Result


Once your app is integrated:


โœ… Your prices follow the shopper's selected currency


โœ… Prices added after page load convert automatically


โœ… Rounding and formatting match the rest of the store


โœ… Shoppers see consistent prices everywhere on the storefront ๐Ÿ’ฑ

Updated on: 30/10/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!