1

I am struggeling by changing the currency symbol in WooCommerce email notifications.

Everywhere you can see the € currency, but as far as you open the emails, you find, that the currency there is £.

I tried to add this function using Snipets:

/**
* change currency symbol to €
*/

add_filter( 'woocommerce_currency_symbol', 'wc_change_uae_currency_symbol', 10, 2 );

function wc_change_uae_currency_symbol( $currency_symbol, $currency ) {
switch ( $currency ) {
case '€':
$currency_symbol = '€';
break;
}

return $currency_symbol;
}

But nothing has changed. Any advice?


Here is a simple image for that also describe the situation:

enter image description here

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50
  • I'm not sure whether or not this will work, as I have never used WooCommerce filters before but according this documentation: https://woocommerce.com/document/change-a-currency-symbol/# you should check the currency symbol (first parameter) rather than the actual currency **code** (second parameter) you are now trying to compare in your `switch` statement. If you want to check for the actual currency code, then refer to this documentation instead: https://woocommerce.github.io/code-reference/files/woocommerce-includes-wc-core-functions.html#source-view.475 – B_CooperA Jan 15 '22 at 22:44
  • 2
    bedauerlicherweise it did not work. this only work on the website. –  Jan 15 '22 at 22:48
  • 1
    Have you tried changing the `case '€':` with one of the following: `case 'EUR':` or `case 'GBP':`? If that does not work, the filter may not apply to email notifications. – B_CooperA Jan 15 '22 at 22:54
  • 2
    @B_CooperA it works only on the frontend. In the emails no thing changes. –  Jan 15 '22 at 23:52

1 Answers1

1

This should fix the issue:

function filter_woocommerce_currency_symbol( $currency_symbol, $currency ) {    
    // Compare
    switch( $currency ) {
        case 'GBP': $currency_symbol = '€';
        break;
    }
    
    return $currency_symbol;
}
add_filter( 'woocommerce_currency_symbol', 'filter_woocommerce_currency_symbol', 1, 2 );

The difference is that you are currently converting € symbol into the € symbol


Tested in WordPress 5.8.3 and WooCommerce 6.0.0

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50
  • thx sir for your answer. I knew what I am doing so I tried what you said, but in the emails no thing changes. Might it be, the currency is only then changes, when the emails sent? (I can't test this out, because im running my wodpress locally only) –  Jan 16 '22 at 10:55
  • @mathandlogic have you already tried [How to debug in WooCommerce 3](https://stackoverflow.com/questions/61740111/how-to-debug-in-woocommerce-3). Since this answer really shouldn't be necessary and if it is, this should just work without further ado. It seems to me that other custom code or a plugin you are using is causing the issue – 7uc1f3r Jan 16 '22 at 11:02
  • this might be. Please be noticed that I'm using the theme Astra –  Jan 16 '22 at 11:04
  • 3
    I fixed the issue just by using another Email Customizer. Thanks sir. –  Jan 16 '22 at 11:24