Woocommerce: How to Change Currency Symbol?

Are you guys looking for currency change in Woocommerce?

In this tutorial, we will discuss two ways of changing currency symbol by editing the plugins or by code snippet.

#1 Editing Woocommerce plugin php file:

The file that holds the code is:

File: wc-core-functions.php
Location: /[your-theme-folder]/wp-content/plugins/woocommerce/includes

In the mentioned file, you will see below function:

$symbols = apply_filters(
    'woocommerce_currency_symbols',
        array(
            'USD' => '$',
...

In this example, we will change the USD as currency symbol to USD.

$symbols         = apply_filters(
    'woocommerce_currency_symbols',
        array(
            'USD' => 'USD',

That’s it! You are done.

#2 Woocommerce: Change currency programmatically using code snippet

If you don’t want to edit the Woocommerce plugins, you can use code snippet plugins or write one of any codes in functions.php file of your theme:

add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'USD': $currency_symbol = 'USD'; break;
     }
     return $currency_symbol;
}

or

add_filter( 'woocommerce_currency_symbol', 'change_currency_symbol', 10, 2 );

function change_currency_symbol( $symbols, $currency ) {
if ( 'USD' === $currency ) {
return 'USD';
}

if ( 'EUR' === $currency ) {
return 'Euro';
}

if ( 'AED' === $currency ) {
return 'AED';
}

return $symbols;
}

You can change all currency symbols if you are developing a multi-language website.

The advantage of this  2nd method is that when you update your Woocommerce plugin, your changes on currency symbol will still be there. You can hire WordPress developer too if you are new to WordPress and don’t know about where to find files and how to edit.

16 Shares:
Leave a Reply
You May Also Like
Read More

How to Choose the Best Web Design Company

It’s better to hire a reputable and top web design Company in USA for a custom functional website. Now the question is how to choose the best web design company in USA? Here are some things you need to avoid when hire a web design agency-
Read More