Skip to content Skip to sidebar

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 10 replies, has 2 voices.

Last updated by Bobby 1 year, 9 months ago.

Assisted by: Bobby.

Author Posts
September 29, 2023 at 11:32 pm #14490337

moazH

Hi there,

The currency switcher is showing the currencies in Arabic language even if the website language is switched to english, It must only show SAR if english and ر.س if Arabic "for example"

hidden link

Screenshot 2023-09-30 at 2.31.13 AM.png
October 2, 2023 at 7:05 pm #14500277

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Please go to WooCommerce->WooCommerce Multilingual->Multi-Currency and edit the currency switcher.

There you will be able to edit what displays -- to improve the way it displays, likely remove "%name% (%symbol%) -" and leave only %code%

https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-widget

"%name% – full name of the currency, for example “Euro”
%symbol% – the standard symbol that represents the currency, for example “$” or “€”.
%code% – the standard code that represents the currency, for example USD for United States Dollar.
%subtotal% – total costs of the current order (basket), without shipping costs and additional taxes. Subtotal is the formatted price and includes the currency symbol positioned according to the currency options set in WooCommerce settings."

October 4, 2023 at 9:10 pm #14515683

moazH

I have already edited the currency switcher widget but I can not edit the price view in the products as I mentioned before, It's displaying ر.س while I am on the english language

Screenshot 2023-10-05 at 12.08.53 AM.png
October 4, 2023 at 9:14 pm #14515713

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

October 4, 2023 at 9:44 pm #14515809

moazH

Access Granted

October 5, 2023 at 7:19 pm #14523017

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

The access granted in the other thread we are working on is no longer working for our team.

October 5, 2023 at 8:28 pm #14523141

moazH

sorry, I didn't get your point !

October 6, 2023 at 12:02 am #14523511

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

You mentioned "Acceess Granted", however, we have no access to the backend.

I have re-enabled the private field reply. Please share with me access to further review this issue so we can provide the best solution possible.

October 6, 2023 at 5:57 pm #14530663

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you!

Reviewing this everything looks correct, the reason the currency symbol is not changing is that it's directly controlled by WooCommerce and not WPML, therefore it cannot be translated using WPML String Translation.

You can, however, add the translation by using the following workaround provided by my colleague.

https://wpml.org/forums/topic/currency-need-sar-when-switch-to-english-and-normal-arabic-%D8%B1-%D8%B3/#post-13501673

Let me know your results, please.

October 8, 2023 at 4:48 pm #14535143

moazH

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

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'SAR':
if(ICL_LANGUAGE_CODE=='en'){
$currency_symbol = 'SAR';
}else{
$currency_symbol = 'ر.س';
}
break;
}
return $currency_symbol;
}

-----------------------------------------
I just added the code but it worked only for 1 currency, I have 3 currencies that I need to apply this for, how is it possible?

October 9, 2023 at 9:14 pm #14542661

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for updating me!

You can try adding 2 more cases for the rest of the currencies

See this for example:

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'SAR':
if(ICL_LANGUAGE_CODE=='en'){
$currency_symbol = 'SAR';
}else{
$currency_symbol = 'ر.س';
}
break;
case 'EUR':
if(ICL_LANGUAGE_CODE=='en'){
$currency_symbol = 'SAR';
}else{
$currency_symbol = 'ر.س';
}
break;
case 'GBP':
if(ICL_LANGUAGE_CODE=='en'){
$currency_symbol = 'SAR';
}else{
$currency_symbol = 'ر.س';
}
break;
}
return $currency_symbol;
}

Make sure to replace the case 'EUR' and case 'GBP' with the correct ones along with the language code and symbols

Let me know your results, please.