How to change the currency symbol in WooCommerce

woo expert

The other day a blog reader asked me if he could change the currency symbol in WooCommerce because in his case WooCommerce uses the same symbol ($) for the US dollar and the Argentine peso.

I gave him a simple solution but today I want to expand it a bit, in case you have a similar need.

Change currency symbol in WooCommerce with codes.

Let’s start with the simplest, which would be to change only one WooCommerce currency symbol. The code would look like this:

/* Change dollar symbol */ add_filter('woocommerce_currency_symbol', 'wphelp_change_dollar_symbol', 10, 2); function wphelp_change_dollar_symbol( $currency_symbol, $currency ) { switch( $currency ) { case '$': $currency_symbol = 'USD'; break; } return $currency_symbol; }
Code language: PHP (php)

This would be the concrete example that the reader asked me for, where we change the default dollar symbol ($) to USD, to distinguish it from others, such as the Argentine peso.

Now let’s see another example, with a variation of the previous code, but in this case to change several currency symbols:

/* Change currency symbols */ add_filter('woocommerce_currency_symbol', 'wphelp_change_currency_symbols', 10, 2); function wphelp_change_currency_symbols( $currency_symbol, $currency ) { switch( $currency ) { case '$': $currency_symbol = 'USD'; break; case '€': $currency_symbol = 'EURO'; break; case '£': $currency_symbol = 'POUND'; break; case '¥': $currency_symbol = 'YEN'; } return $currency_symbol; }
Code language: PHP (php)

Here we have added another set of changes, in addition to the one in the first example.

Another way to achieve the same result would be through conditional if statements, like this:

/* Cambio de simbolo de divisas */ add_filter('woocommerce_currency_symbol', 'wphelp_change_currency_symbols', 10, 2); function wphelp_change_currency_symbols( $currency_symbols, $currency ) { if ( 'USD' === $currency ) { return 'USD'; } if ( 'EUR' === $currency ) { return 'EURO'; } if ( 'GBP' === $currency ) { return 'POUND'; } return $currency_symbols; }
Code language: PHP (php)

In this type of code, you must first indicate the currency code used by WooCommerce for the currency you want to modify (if ('CODE' === $currency)), and then (return 'symbol') what you want to display instead.

If you don’t know the currency codes used by WooCommerce they are all these.

How do I add these codes?

If you don’t know how to add these or other codes I encourage you to check this simple guide on how to copy and paste codes in WordPress…

Change currency symbol in WooCommerce with plugins

If you prefer to use a plugin to change the currency symbols in WooCommerce, there is one that serves to change the currency symbol active by default in WooCommerce. It is not as complete as with the previous codes but it could be useful if you just want to change the current currency symbol.

It’s called Change Currency Symbol and it’s very easy to use. When you have installed and activated it, go to the general settings of WooCommerce and, in the currency options section, you will see a new setting in which to indicate the symbol you want to replace the current currency symbol in the settings.

new setting with the new plugin

Save the changes and you are done.

How useful was this post?

Click on a smiley to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Skip to content