Commerce module endeavors to define all legal currencies, so please open an issue if yours is missing. However, modules can use this hook to add custom / site-specific currencies, such as user points or credits.
The currency data structure is as follows:
Example currency definition:
<?php $currencies['USD'] = array( 'code' => 'USD', 'numeric_code' => '840', 'name' => t('United States Dollars'), 'symbol' => '$', 'major_unit' => t('Dollar'), 'minor_unit' => t('Cent'), 'symbol_placement' => 'before', ); ?>
Modules can use this hook to alter properties of any defined currencies. This hook should be used with extreme caution, as the currency code and decimals values of each currency are intimately tied into price field values. Changing codes and decimals values may cause wide disruption of store price values, so such alterations should be made prior to setting prices and collecting orders and not after moving to production.
Additionally, because every currency's default conversion rate is 1, this hook can be used to populate currency conversion rates with meaningful values. Conversion rates can be calculated using any currency as the base currency as long as the same base currency is used for every rate.
A single currency array is referred to as $currency. An array of currency arrays keyed by code is referred to as $currencies. The code of a currency is referred to as $currency_code.
Found errors? Think you can improve this documentation?
edit this page