Rounding down converted currencies

Shopify Partner
7 1 0

Hi there. 

My shop's base currency is USD. The prices have trailing zeros and looks great in USD but looks visually unappealing when viewed in a converted currency. I am looking for a solution to round down all available currencies. Can it be done?

Below is where I think the conversion happens. Could Math.floor() be used here? and if so, where do I put it?

I can manage some level of coding but this is beyond me. Hope someone can help. Thanks!

 

  /**
   * -------------------------
   * AUTOMATIC CURRENCY CONVERSION
   * -------------------------
   */

  (function() {
    {% if settings.currency_conversion_enabled %}
      {% if settings.currency_conversion_money_format %}
        Currency.format = {{ settings.currency_conversion_money_format | json}};
      {% endif %}

      var shopCurrency = window.shop.shopCurrency,
        currencySelector = $('.currency-selector__select');

      // Sometimes merchants change their shop currency, let's tell our JavaScript file
      Currency.moneyFormats[shopCurrency].money_with_currency_format = window.shop.moneyWithCurrencyFormat;
      Currency.moneyFormats[shopCurrency].money_format = window.shop.moneyFormat;

      // Default currency
      var defaultCurrency = {{ settings.currency_conversion_default_currency | json }} || shopCurrency;

      // Cookie currency
      var cookieCurrency = Currency.cookie.read();

      // If there's no cookie.

      if (cookieCurrency == null) {
        if (shopCurrency !== defaultCurrency) {
          Currency.convertAll(shopCurrency, defaultCurrency);
        } else {
          Currency.currentCurrency = defaultCurrency;
        }
      } else if (currencySelector.length && currencySelector.find('option[value=' + cookieCurrency + ']').length === 0) {
        // If the cookie value does not correspond to any value in the currency dropdown.
        Currency.currentCurrency = shopCurrency;
        Currency.cookie.write(shopCurrency);
      } else if (cookieCurrency === shopCurrency) {
        Currency.currentCurrency = shopCurrency;
      } else {
        Currency.convertAll(shopCurrency, cookieCurrency);
      }

      currencySelector.val(Currency.currentCurrency).change(function() {
        var newCurrency = $(this).val();

        currencySelector.val(newCurrency); // We need to do that as we have multiple selector in the page so we must duplicate the new value everywhere
        Currency.convertAll(Currency.currentCurrency, newCurrency);

        $('.selected-currency').text(Currency.currentCurrency);
      });
    {% endif %}
  })();

 

0 Likes
Shopify Expert
9807 92 1560

Wouldn't it be better to show the accurate price to the customer rather than making it cheaper than what it actually is - all for a more appealing design?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
New Member
2 0 0
My problem is the opposite. I engaged Shopify expert to do the currency selector, but now all the other country currency is rounded to a full amount the only USD remains the same. The Shopify expert says he cannot make it have actual 2 decimal place behind. Is this true? Please, kindly advice, like this is not fair for the customers and i think customers will not be happy about it.
0 Likes