You have two options:
Contact Woo
You can ensure your changes will be permanent by contacting WooThemes (the authors of the plugin) directly and asking them to add your country’s currency to the list.
Use a filter
Alternatively, remember that everything is filtered. Woo is using the woocommerce_currency_symbol
filter in woocommerce.php
. To add currencies to that list, you’d use:
function add_my_currency_symbol( $currency_symbol, $currency ) {
if($currency == "USD") {
$currency_symbol="$";
}
return $currency_symbol;
}
add_filter( 'woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2 );
Whenever Woo calls their function, they pass the currency symbol through a filter before returning it. You’re just hooking on to that filter, checking to see if the currency matches your custom value, and returning a custom symbol if so. I used US dollars here as an example, but substitute whatever it is you need.
To add your currency to the settings page, you’ll hook into the woocommerce_currencies
filter:
function add_my_currency( $currencies ) {
$currencies["USD"] = 'US Dollars ($)';
return $currencies;
}
add_filter( 'woocommerce_currencies', 'add_my_currency', 10, 1 );
Woo is adding an array of currencies to their options panel. All this does is look at the array, add your custom currency, then return it so the function can operate as normal.
Where to put this code
To use these filters, you’ll have to write a second plugin. Give it a unique name and activate it as you would any other plugin. When you update WooCommerce, so long as they don’t change their filter names, you shouldn’t lose any customizations.