Are you looking for a way to change the currency symbol in WooCommerce? While there’s probably a plugin for this, we have created a quick code snippet that you can use to change the currency symbol in WooCommerce.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'AUD': $currency_symbol = 'AUD$'; break; } return $currency_symbol; }
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 6 best Stripe payment plugins for WordPress and how to create a review site in WordPress.
Hi, thank you! this works throughout the site but does not work when I receive new order emails, or customer receives the order confirmation email. The symbol is $ only in the emails. Do you know how to add it to the emails too?
I’m trying to replace the code symbol for Mexican pesos from $ to MXN $.
I tried this snippet, but it didn’t work. Any thoughts?
add_filter(‘woocommerce_currency_symbol’, ‘change_existing_currency_symbol’, 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case ‘S’: $currency_symbol = ‘MXN $’; break;
}
return $currency_symbol;
}
I tried
Thank you .. it worked