How to change the currency symbol in WooCommerce

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

I gave you a momentary 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 thing, which would be to change only one WooCommerce currency symbol . The code would be like this:

 / * Dollar symbol change * /
add_filter ('woocommerce_currency_symbol', 'helpwp_change_dollar_symbol', 10, 2);
function helpwp_change_dollar_symbol ($ currency_symbol, $ currency) {
switch ($ currency) {
case '$': $ currency_symbol = 'USD'; break;
}
return $ currency_symbol;
}

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

Now we are going to see another example, with a variation of the previous code, but in this case to change several currency symbols :

 / * Currency symbol exchange * /
add_filter ('woocommerce_currency_symbol', 'helpwp_change_currency_symbol', 10, 2);
function helpwp_change_currency_symbol ($ 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;
}

We have added another set of changes here, in addition to the first example.

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

 / * Currency symbol exchange * /
add_filter ('woocommerce_currency_symbol', 'helpwp_change_currency_symbol', 10, 2);
function helpwp_change_currency_symbol ($ currency_symbols, $ currency) {
if ('USD' === $ currency) {
return 'USD';
}
if ('EUR' === $ currency) {
return 'EURO';
}
if ('GBP' === $ currency) {
return 'POUND';
}
return $ currency_symbols;
}

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

If you do not know the currency codes that WooCommerce uses, they are all of these .

How do I add these codes?

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

How and where to paste PHP, JS, CSS codes and functions that you find out there in WordPress

Change the 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 symbol of the active currency by default in WooCommerce . It is not as complete as with the previous codes but it could be useful if you only want to change the symbol of the current currency.

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

Save the changes and you have it.

( 4 votes, average: 5 ) Rate this article to help improve the quality of the blog
Share on Twitter Share on Facebook Share on Pocket Share on LinkedIn Share on WhatsApp Share on Telegram

Did you like this article? You can’t imagine what you’re missing on YouTube !

About Us

We are BE OF THEM, a team specialized in the field of digital marketing and programming, our headquarters is in Germany, and our activity has expanded to reach all parts of the Middle East, especially the Arab Gulf countries.

Do you need to raise your site's score?

We have the perfect solution for marketing your business

Contact Us

Call us, or message us by email & whatsapp

We will be happy to talk to you, and knowing everything about your work.

All rights reserved, © 2021