Adding Currency Support: edd_currencies
The “edd_currencies” filter allows you to easily add support for your own additional currencies to Easy Digital Downloads.
Let’s say, for example, that you want to add support for the Indian Rupee (already supported, so this is only an example). The sample function below would add the support:
function pippin_extra_edd_currencies( $currencies ) { $currencies['INR'] = __('Indian Rupee', 'your_domain'); return $currencies; } add_filter('edd_currencies', 'pippin_extra_edd_currencies');
The array key is the currency code and the value is the currency label.
Note: It is important that you know that not all payment gateways support all currencies. Check to make sure that your chosen gateway supports the currency you wish to use before launching your store. Once added, test a purchase to confirm the gateway uses the correct currency.
If you wish to use a different symbol for a custom currency then you need to set that in a filter using the example below:
add_filter( 'edd_inr_currency_filter_before', function( $formatted, $currency, $price ) { return '$ ' . $price; }, 10, 3 );
In this example we will be using the $ symbol for the INR currency. Notice that the filter we used is “edd_inr_currency_filter_before”. For a different currency you will need to adjust the “inr” to match the new currency you are adding.
If your currency symbol is set to be displayed after the amount then the filter will be “edd_inr_currency_filter_after”.
Currency codes may also be added without using any code through
this plugin.
FAQs
Why isn’t my currency listed?
Before we can add support for a new currency, it needs to be supported by all gateways. This is to prevent payment failures or unexpected fees. If you would like to request that a currency gets added to Easy Digital Downloads, please contact
support.