Thursday, February 10, 2022

[FIXED] Change currency symbol in WooCommerce emails notifications

Issue

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


Solution

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



Answered By - 7uc1f3r

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.