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.

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

Full-stack vs. Specialized Developer – Whom to Hire?

Are you a startup or established business? Are you looking for someone who can handle multiple tasks by his own or specialized in specific job? You might be surprising if I say that hiring the full-stack developer is best choice instead of a few specialists who are experienced to handle each development process layer separately.
Read More
Read More

IT Recruiting Trends: How to Source Tech Talent in 2023

As the global economy cools down, the list of tech companies that are freezing hires or even announcing large layoffs keeps growing. This job market trend provides businesses struggling to attract tech talent with a nice opportunity to hire qualified candidates from a larger-than-average applicant pool.
Read More