This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Raja Mohammed 4 weeks ago.

Assigned support staff: Raja Mohammed.

Author Posts
September 15, 2019 at 10:14 pm #4575457

thiagoP-5

I use "US Dollars" but the symbol only shows "$", so my users don't know if we sell in USA, CAN or AUS Dollars, for example.
hidden link

September 16, 2019 at 6:55 am #4576645

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello there,

You can override the display of currency symbol with currency name by using the below code in your theme functions.php file

 function sww_change_wc_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'USD': 
// Display USD for US Dollars
  $currency_symbol = 'USD'; 
   break;
  case 'AUD': 

// Display AUD for Australian dollar
  $currency_symbol = 'AUD'; 
   break;

case 'CAD': 
// Display CAD for canadian Dollar

  $currency_symbol = 'CAD'; 
   break;
      }
     return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'sww_change_wc_currency_symbol', 10, 2);

Reference : hidden link

I hope this helps you better

Kind regards
Raja

September 16, 2019 at 12:25 pm #4580117

thiagoP-5

Hi, thanks!

Actually I just have 2 currencies: Brazilian Real (which is fine, with the correct symbol "R$" ) and US Dollars, which is showing only "$" as symbol.
Can you give me the code with US Dollars / Brazilian Real? (AUS and CAN were only to explain the issue)

Thanks

September 17, 2019 at 4:31 am #4585547

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To display only US Dollars as US$ use be below code you can adjust the code as per your requirement. I hope the display of Brazilian real doesn't need any adjustment.

function sww_change_wc_currency_symbol( $currency_symbol, $currency ) {
     switch( $currency ) {
          case 'USD': 

 // Display US$ for US Dollars change the symbol here
  $currency_symbol = 'US$';  
   break;

      }
     return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'sww_change_wc_currency_symbol', 10, 2);