0

In my project I had to change currency code from USD to IRR (Iranian Rial)

but in Persian language after currency, there is always a "," character in rendered price (in price component or formatted amount).

Anyone knows how can we get rid from this comma.

I've attached an image about this issue

2
  • You didn't specify whether this is D7 or D8. – Bojan Zivanovic Oct 1 '18 at 19:23
  • excuse me, I am using D7 – Mehrdad201 Oct 3 '18 at 6:18
0

In commerce.currency.inc the currency is defined as:

'IRR' => array(
  'code' => 'IRR',
  'numeric_code' => '364',
  'symbol' => 'REMOVED_DUE_TO_SE_ERROR',
  'name' => t('Iranian Rial'),
  'symbol_placement' => 'before',
  'symbol_spacer' => ',',
  'code_placement' => 'hidden',
  'minor_unit' => t('Rial'),
  'major_unit' => t('Toman'),
  'decimals' => 0,
),

If you wanted to override this and set the thousands_separator (not present) to and empty string. You can do this in hook_commerce_currency_info, documented here http://cgit.drupalcode.org/commerce/tree/commerce.api.php?h=7.x-1.x#n11

You need to set it as, let's say '' because the defaults are the following for missing properties:

  $defaults = array(
    'symbol' => '',
    'minor_unit' => '',
    'decimals' => 2,
    'rounding_step' => 0,
    'thousands_separator' => ',',
    'decimal_separator' => '.',
    'symbol_placement' => 'hidden',
    'symbol_spacer' => ' ',
    'code_placement' => 'after',
    'code_spacer' => ' ',
    'format_callback' => '',
    'conversion_callback' => '',
    'conversion_rate' => 1,
  );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.