Skip to content

Instantly share code, notes, and snippets.

@nord
Created September 19, 2016 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nord/a3716e50ca51e135bdacd8715525f0cb to your computer and use it in GitHub Desktop.
Save nord/a3716e50ca51e135bdacd8715525f0cb to your computer and use it in GitHub Desktop.
Create invoices in different currency and fetch the latest exchange rates. Used by Sufio for Shopify (sufio.com/shopify). http://sufio.com/articles/shopify/create-invoices-from-orders/multiple-currencies/
<!-- Created invoices in EUR. Used by Sufio for Shopify (sufio.com/shopify). -->
<input type="hidden" name="attributes[Invoice Currency]" value="" />
<input type="hidden" name="attributes[Invoice Currency Rate]" value="" />
<script src="//cdn.shopify.com/s/javascripts/currencies.js" type="text/javascript"></script>
<script type="text/javascript">
var currency_code = 'EUR'; // Invoice Currency Code
var currency_rate = 1/Currency.rates[currency_code];
$('input[name="attributes[Invoice Currency]"]').val(currency_code);
$('input[name="attributes[Invoice Currency Rate]"]').val(currency_rate);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment