This small WordPress snippet allows you to change the default currency symbol in WooCommerce. For example, it replaces the Australian Dollar symbol (A$) with a more explicit format (AUD$).
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;
}You can add this snippet in one of the following ways:
- Open your active theme folder:
/wp-content/themes/your-theme/ - Edit the
functions.phpfile. - Paste the code at the end of the file.
- Save changes and refresh your WooCommerce store.
- Open your child theme folder:
/wp-content/themes/your-child-theme/ - Edit the
functions.phpfile. - Paste the code there and save.
- Your currency symbol will update automatically.
- Create a new plugin file inside:
/wp-content/plugins/ - Add the snippet inside your plugin file, wrapped with plugin headers.
- Activate the plugin from the WordPress dashboard.
You can extend the switch statement to include more currencies.
For example:
switch( $currency ) {
case 'AUD': $currency_symbol = 'AUD$'; break;
case 'USD': $currency_symbol = 'US$'; break;
case 'GBP': $currency_symbol = '£'; break;
}- WordPress
- WooCommerce plugin