WooCommerce has a ton of options for multiple currencies right out of the box. WooCommerce comes bundled with dozens of different currencies you can use in your store, there are snippets to add extra currencies,ย there's also have a really nice Currency Converter Widget to help you display different currencies in your store.
By default WooCommerce will display the currency symbol with the product. You can do all sorts of things like choosing the position of the symbol (some currencies the symbol goes on the right of the number), you can change the decimal separator (some currencies prefer commas to decimal points), and you can change the number of decimal places (some currencies like Yen don't have decimals). We have docs for all of these settings.
This works great for 99% of the stores out there. There are a few exceptions that might require a couple snippets of code to display it exactly the way you want.
Duplicate Currency Symbols
One specific example is with currencies that share symbols. For example the Australian, New Zealand,ย Singapore, and the US all user the same dollar symbol: $. This isn't too big of an issue if you cater to a specific country or region but some users won't understand the difference until they see the bill, or if using PayPal they see the converted total.
Add Currency Code Before Symbol
A potential solution is to show the currency code before the symbol. This way there isn't any confusion about the currency. Go ahead and download this mini plugin and install it into your site.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Display Currency Code in Currency Symbol | |
* Plugin URI: https://gist.github.com/BFTrick/10681832 | |
* Description: Add the currency code to the currency symbol in WooCommerce. Ex. USD $. | |
* Author: Patrick Rauland | |
* Author URI: http://patrickrauland.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU General Public License for more details. | |
* | |
* You should have received a copy of the GNU General Public License | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |
* | |
*/ | |
function patricks_currency_symbol( $currency_symbol, $currency ) { | |
switch( $currency ) { | |
case 'USD': | |
$currency_symbol = 'USD $'; | |
break; | |
case 'NZD': | |
$currency_symbol = 'NZD $'; | |
break; | |
case 'AUD': | |
$currency_symbol = 'AUD $'; | |
break; | |
} | |
return $currency_symbol; | |
} | |
add_filter('woocommerce_currency_symbol', 'patricks_currency_symbol', 30, 2); |
You can do this with any currency. I just did it for US, Australian, & New Zealand dollars. You just need to enter your three letter currency code located in the get_woocommerce_currencies
function.
Thanks for this it worked perfectly!
Looks great – does this also work with order notification emails?
Yup! This should work throughout WooCommerce. ๐
Thanks Patrick, this worked exactly as required ๐
Hi Patrick! Do you have any updated version of this plugin? It would really help me out now! :/ Or any suggestions as to how to add the currency code?
Perfect thanks.
How do I get this code into a format suitable for uploading to woocommerce as a plugin extension?
The easiest solution is probably to copy the code and paste it into a new PHP file. Drop that PHP file into your wp-content/plugins directory.
You’ll probably want a code editor to paste the code and create the PHP file. There is an official list of Text Editors for WordPress.
I hope that helps! ๐
Awesome, worked like a charm…
I run an affiliate site using WooCommerce to control the look of the products displayed. So the cart of WooCommerce is not used at all.
I now want to take on a New Zealand merchant but have no way to display their products with NZD either before or after the prices shown. Other merchants are in USD.
Do you have a suggestion for me how I could handle this issue please?
Wow – what an interesting problem! I don’t think there are any solutions for this. WooCommerce is designed to use one currency. I’d have something custom built. There could be an extra setting on the product page where you select a currency which could replace the default currency.
For something like this I’d use Codeable. They do awesome customizations.
I hope that helps! ๐
I’m setting up a site in Canada that charges USD for its products. Currently it just says $2000. I’d like it to say USD $2000. I think your plug-in will do that.
Where do I put the PHP file for the code to take effect?
This code is a plugin. You can download it and then upload the file to your site’s
/wp-content/plugins/
directory. Then activate it. I hope that helps! ๐Thanks a lot, you are awesome and I totally appreciate the work you’ve put into this plugin!
Perfect. Thank you.
It is not working properly with invoices and emails. Please help me with this.
Here is my own version, inspired by your guide:
function currency_indicator( $currency_symbol, $currency ) {
global $post;
// just on cart and checkout pages
if ( is_product() )
return $currency_symbol;
else
return $currency . ' ' . $currency_symbol;
}
add_filter( 'woocommerce_currency_symbol', 'currency_indicator', 30, 2 );
Thanks for sharing! ๐
Thanks for this – exactly what we needed.
Glad to help! ๐
Wonderful! Simple, quick, and helps when we know that the world doesn’t always revolve around the USD!!!
Happy to help. ๐
Brilliant! Thank you!!
hi, i cannot make it work on this.
the plugins is activated but when echo get_woocommerce_currency_symbol() it still $ rather then USD$ in themes.
any thing i did wrong? tq
Hi,
Thank you ๐
I would like to ask about the reports. (Woocommerce>Reports>Orders)
How can it show multiple currencies?
Right now it sum up all orders and shows the total in USD .
I only have CAD and USD in my shop at the moment.
Thank you for your time and skillz
Much appreciated ๐
To add some info I am using the WooCommerce Product Price Based on Countries plugin. Don’t really know if it matters for the reports…
Hi Thanks this works perfectly, just a query if it is possible, i will like to show the price ( $ 65.65 USD).
I am also interested to use it $ 65.65 USD. Any help?
I Also want to have ( $ 65.65 USD).
Yes, how can I have AUD at the back of the amount instead of at the front. Thanks and appreciate your help.
THANK YOU!! This works like a charm. ๐
The currency code plugin is great ๐
Thank you for sharing
Thanks a lot. It really solved my problem.
Is there any way to display the currency symbol only at the checkout page?
I’m sure you could do that. You can use WooCommerce conditionals to only display it on the checkout. You’ll want to look into the
is_checkout()
conditional.I hope that helps! ๐
hi, please i tried but did not work. Am using child theme of spacious theme. WordPress version 4.5.3 and woocommerce Version 2.6.2. Please patrick, help me. I will really be grateful.
Thanks a lot, you are awesome and I totally appreciate the work youโve put into this plugin!
Works exactly what i need… ๐
Thanks
why can’t i find this plugin?
Hi Patric,
Great your plug-in work fine thank you very much
Ram
Thanks a lot! This simple but effective way of showing the currency with the price saved me from paying for the premium version of a plugin.
Sorry for this rudimentary question – where should I add this function code in? Is it plugins -> editor -> woocommerce , or appearance editor? I am really a beginner.
Amaazing! Thanks Patrick! I’m so happy now! I originally messaged the wordpress “happiness engineers” and they guided me to your plugin but since I have no experience in coding, I had no idea how to enter it and make it work. They told me they couldn’t help me or it might break my site and they weren’t sure if the code still worked since it’s been a few years. I installed the plugin called, “Code Snippets” and inputted the shorter version of your code, hit activate, voila, it worked! The longer coder with more currencies came up with a Syntex error so I just edited the shorter code to work with the currency codes I needed. That was super easy and didn’t break my site or cause me stress. Thanks, so much again!
Hey Julie! So glad you were able to get it to work.
My website crashed after I put in the codes through code snippets in wordpress. Now I can’t even access my wordpress the whole website is down. What shuold I do?
Log into your site via FTP. Delete the plugin.
Created a folder, created a php file with the code, uploaded via FTP, doesn’t appear as a plugin. Is there any reason you can’t package this as a plugin that people can download and upload/activate?
That worked perfectly fine. Thanks! ๐
Hi there,
Thanks for this, works great! Is it possible to have the code as a suffix instead of a prefix?
Thanks,
Luther
That worked. Very thanks!
Hello Patrick, thanks for your post, your code work perfectly in the page products, however I have a small problem, my Shop work with several currency and in the mini cart wiget, donยดt work the currency diferentiation, all products show the default currency of my shop. You have anything idea how solve my problem? thanks
Fantastic I luve it when you find a plugin for such a specific purpose Well Done!!
Patrick, You are literally the smartest guy on the planet, after searching the whole of the internet I could not find a solution for this and by chance i clicked on this post. I could’ve been lost for days. cheers my bro!
I just added this to my site. Now my Canadian and Australian customers will not be confused when their card statement shows a different amount. Perfect solution – thanks!
Thanks for sharing!
Can we all at least take this lesson and agree that WC has consistently, over the years, lacked of common sense here, throughout the different plugins regardless which one it has been.
Using currency symbols instead of currency ISO codes, let alone not giving people the option to choose, among other issues have the following consequences:
– Errors for structured data
– Errors for Google Merchant products
– Customers can’t god damn differentiate between CAD $, USD $, NZ $, AUD $
Does that make sense? No but does the imperial system even make sense?