title: Shopify, formatMoney use current currency dynamically
body: <p>I am using <a href="https://gist.github.com/stewartknapman/8d8733ea58d2314c373e94114472d44c" rel="nofollow noreferrer">this</a> script for formatting money in Shopify. The problem is that I'd need the flexibility of having multiple currencies and the current function doesn't seem to support it.</p>
  <p>I've tried including that script in a <code>.liquid</code> file, and using <code>{{ currency.symbol }}</code> like: <code>Shopify.money_format = &quot;{{ currency.symbol }}&quot; + &quot;{{amount}}&quot;;</code> or <code>&quot;{{ currency.symbol }}{{amount}}&quot;;</code> or <code>{{ currency.symbol }} + &quot;{{amount}}&quot;;</code> but that gives an error with <code>placeholderRegex</code> which becomes undefined.</p>
  <p>Thanks!</p>
  <p>EDIT:
  This is the code where I use the function:</p>
  <pre><code>Shopify.onItemAdded = function(line_item) {
      jQuery.getJSON('/cart.js', function(cart) {
         // change total price
         $('#popup_total').html(Shopify.formatMoney(cart.total_price))
      });
  };
  </code></pre>
  <p>EDIT[2]: At the end I went with a different approach. I declared the current currency variable outside the function, and then I replace the original $ symbol, with whatever currency symbol the store has. It goes like this:</p>
  <pre><code>var currentCurrency = '{{ cart.currency.symbol }}'
  
  Shopify.onItemAdded = function(line_item) {
      jQuery.getJSON('/cart.js', function(cart) {
           var total = Shopify.formatMoney(cart.total_price).replace('$', currentCurrency)
           $('#popup_total').html(total)
      })
  }
  </code></pre>