Change Woocommerce currency format

Change Woocommerce currency format

Change Woocommerce currency format

Woocommerce displays prices in the currency sign format (example: $) and not in the code format (example: USD).
Fortunately, you can change that easily
Locate your functions.php file in: www.yourdomain.com/wp-content/themes/your-theme-name/functions.php
Add this function:

add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['USD'] = __( 'Name of currency', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
function add_my_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'USD': $currency_symbol = '$'; break;
}
return $currency_symbol;
}

Change ‘USD’ to the currency code that you want to use. It occurs twice, change both.

Change ‘Currency name’ to whatever you want your currency to be named. It will display like that in the dropdown in the settings of Woocommerce where you set the currency.

At the bottom of the code you see $, if you change that to USD for example, it will display like that in your store and in order emails.

After having done all this and saved your functions.php file, go to the Woocommerce settings in your controlpanel, and find your new currency.

 

Article by Morning Train Technologies

Paul Isaris