Skip Navigation

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 1 reply, has 2 voices.

Last updated by Mohamed Sayed 9 months ago.

Assisted by: Mohamed Sayed.

Author Posts
March 27, 2024 at 11:36 am

majdA-7

The currency symbol in the products is in English. I cannot translate it

March 27, 2024 at 12:19 pm
March 27, 2024 at 12:50 pm #15455667

Mohamed Sayed

Hi,

It seems that the symbol is already SAR and translated by WooCommerce to "ر.س" as the default language is Arabic. I updated the code to the following and it works now:

/*Currency Translation*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
     
function change_existing_currency_symbol( $currency_symbol, $currency ) {
    $my_current_lang = apply_filters( 'wpml_current_language', NULL );
    switch( $currency ) {
        case 'SAR':         
        if($my_current_lang == 'ar'){        
        $currency_symbol = 'ر.س'; 
        }else{
                 $currency_symbol = 'SAR'; 
            } 
        break;          
    }
    return $currency_symbol;
}

Please see here: hidden link

Kind regards,
Mohamed

March 28, 2024 at 8:15 am #15459241

majdA-7

thank you very much