Except US Dollar, all currencies using the '$' dollar symbol are prefixed with their country name (eg. AU$, HK$). Similarly, currencies sharing other symbols (eg. '£' , '¥') are also prefixed in the same way.

So for an Canadian site using Canadian Dollar as default but also allow international customers to view in their own currencies. The formatted output is presented as:
CA$100
$101.94
AU$97.63
£62.78

This is totally wrong. The currency symbols should be how they are presented locally, instead of how the US presents foreign currencies.

There would be a confusion for sites using multiple currencies. A possible solution to this problem is the default currency always get to use the symbol without a prefix and additional allowed currencies are presented using the 3 letter currency code.

So for a Canadian site, the formatted output should be:
$100
$101.94 USD
$97.63 AUD
£62.78 GBP

CommentFileSizeAuthor
#7 1551032.aud_.patch538 bytesrszrama
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SeriousMatters’s picture

Issue summary: View changes

added examples

brianV’s picture

Priority: Normal » Major

Just bumping this. I have a Canadian site, and it's rediculous to me that all my prices are represented as:

50.00 CAD

When they should be represented as:

$50.00

I'm actually bumping this to major, since this is a big issue for non-US sites. We can't even display our currency the way every other place in our country does!

rszrama’s picture

Priority: Major » Normal

Hey Brian, if you don't mind, please open a separate issue following the instructions at http://www.drupalcommerce.org/faq/currency-format.

m4olivei’s picture

Hey,

I have a Canadian site as well. Maybe the default for Canada is a bit silly in most cases, but there are hooks provided that let you display your currency however you like. Perhaps it would make a good add on module. In any case, here is an example of what I did:

/**
 * Implements hook_commerce_currency_info_alter().
 */
function mymodule_commerce_currency_info_alter(&$currencies, $langcode) {

  $currencies['CAD']['symbol'] = '$';
  $currencies['CAD']['symbol_placement'] = 'before';
}

I'm altering the CAD currency here, but it would work equally well for other currencies. Note that any change you make to this alter hook requires a clearing your cache for the change to show up on the site, as Commerce caches all this currency information. See commerce.api.php for more details.

SeriousMatters’s picture

m4olivei,

As far as I know, there is no single format that would please everyone. Take Canadian dollar for example, the $ sign is placed before number for English speaking community but after the number for French speaking community. But that is a customisation question.

I know the currency display can be customised via hook, patch, hack... There are many other topics on patching/customising the currency output already. But this issue is not about customisation. This issue is about a design error that may cause serious problem to sites that works with multiple currencies.

eg, a site showing something in 2 currencies could be mistaken as the same currency + tax
eg2. In a multi-lingual site using the same US Dollar, the Chinese version displays $100 USD while en-us version displays $100.

There are quite a lot of things to consider. Perhaps we need to include the 'default currency' into the formatting logic. I do not have a solid analysis on the issue as I don't have a multilingual Commerce site yet (planning one soon). For now, I am just pointing out that something needs to be done about it.

P.S. maybe change title to something more fitting?

m4olivei’s picture

I hear ya. Just putting in an alternative for people like me that landed here after a google search. I think the info and alter hooks provided could be used to write a contrib module with an interface for setting this stuff.

jlhs’s picture

Although as commerce currently stands, price as xx.xx AUD is better than it used to be which was AU$xx.xx

Really a dollar sign should be at the front always for a an Australian Dollar amount. Having $xx.xx AUD simply by adding a dollar sign at the front would be an excellent improvement and stop people having go into the code to do this everytime the module is updated. If you make this permanent, no Australian is going to complain, as we always start prices with a dollar sign. simply by doing the below solves this issue, but it needs to be made a permanent fix, as if someone updates the module it will just be overridden. Trust me, every single Australian user will want a dollar sign at the front (Aussies will be relieved not frustrated at seeing the dollar sign). Having no dollar sign is not good, not good at all...

Ultra simple fix as below, just needs to be put in permanently be developers, still having AUD at the end as well as the dollar sign will not conflict with the US dollar :

'AUD' => array(
'code' => 'AUD',
'symbol' => '$',
'name' => t('Australian Dollar'),
'numeric_code' => '036',
'symbol_placement' => 'before',
'minor_unit' => t('Cent'),
'major_unit' => t('Dollar'),
),

rszrama’s picture

Status: Active » Needs review
FileSize
538 bytes

Just to be clear here, would Australian Drupal Commerce developers love this patch?

larowlan’s picture

Speaking as an AU developer.
There's an alter hook for hook_commerce_currency_info() : http://drupalcontrib.org/api/drupal/contributions!commerce!commerce.api....
If so, this is superfluos - implement the alter hook, remove the AU, problem solved.
In my opinion thats 'closed won't fix'

rszrama’s picture

Well, I'm happy to have it fixed in the core to prevent that if there's no compelling reason to leave it the way it is. I suppose it's worth leaving alone if Australian sites typically involve multiple types of Dollars and always represent Australian dollars as AUD - but I believe the intention is really for the currency info array to represent the formatting of a currency in its home market. (See for example the Swiss Franc, which uses the Fr. symbol instead of CHF even though there are other types of Francs.)

benjy’s picture

I'm all for this patch. We certainly always change it to $200 AUD for multi-currency websites and usually $200 for sites only trading in Australia.

+1 from me.

rcross’s picture

+1 for this patch. While its easy to change/override, the majority of customers we've worked with don't want the "AU$" style so this would represent an improvement to the common use case in Australia.

rszrama’s picture

Title: remove prefix from symbol to reflect actual local usage (eg. AU$ -> $) » Fix AUD default currency formatting
Category: bug » task
Status: Needs review » Fixed

Thanks for the feedback, folks. Putting it in; note that this won't mess up any site currently altering, but it could help ya do less altering in the future. : )

SeriousMatters’s picture

Thanks for the fix. But there are about 30 currencies using the dollar $ sign. Should we raise a new issue for each of these currencies? And also for each of the many £ and ¥ currencies as well?

rszrama’s picture

We've basically followed the policy at http://www.drupalcommerce.org/faq/currency-format, which is that if there is a standard format for a currency in its home market, we should use it. However, we haven't intentionally pursued trying to figure this out for every currency, waiting for someone with a specific site in development who knows the market to advise us of the format. That happened here, but I don't care to write one giant patch that does it for all currencies without local insight. imo, it's better to use the generic format than to suddenly change to an incorrect one.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

changed formatting