Skip to content

Instantly share code, notes, and snippets.

@nord
Last active March 4, 2016 17:57
Show Gist options
  • Save nord/5ef306867385e3ec4043 to your computer and use it in GitHub Desktop.
Save nord/5ef306867385e3ec4043 to your computer and use it in GitHub Desktop.
Integration between Sufio and Coin apps to enable multi-currency support. Read more at http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Integration between Sufio and Coin apps to enable multi-currency support. -->
<div class="invoice-currency-container" style="display:none;">
<input type="hidden" id="invoice-currency" name="attributes[Invoice Currency]" value="" />
<input type="hidden" id="invoice-currency-rate" name="attributes[Invoice Currency Rate]" value="" />
<input type="hidden" id="invoice-usd-rate" name="attributes[Invoice USD Rate]" value="" />
</div>
<script type="text/javascript">
$( document ).on( "shoppad:coin:currencychange", function() {
$("input#invoice-currency").val(window.Shoppad.apps.coin.getLocalCurrency());
$("input#invoice-currency-rate").val(window.Shoppad.apps.coin.getLocalCurrencyUSDExchangeRate() / window.Shoppad.apps.coin.getBaseCurrencyUSDExchangeRate());
$("input#invoice-usd-rate").val(window.Shoppad.apps.coin.getLocalCurrencyUSDExchangeRate());
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment