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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 6 replies, has 3 voices.

Last updated by Marcel 1 year, 10 months ago.

Assisted by: Marcel.

Author Posts
September 6, 2023 at 8:34 am #14349405

Ahmed Sabbour

i want to make currency symbol SAR if English and ر.س if language is Arabic but the symbol not appear in the Arabic and checkout always fail to proceed

I used the below Snappit to do this

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;
}

you can check this sample project hidden link

September 7, 2023 at 10:03 am #14358125

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for contacting WPML Support.

I understand what you're looking for. These currency symbol/code are directly controlled by WooCommerce's code, Even if WPML was not used, this is what WooCommerce would display by default.

However, by using the WooCommerce hooks for changing currency symbols, it is possible to change the symbol for each language. Please follow the documentation below to understand the process.

- https://docs.woocommerce.com/document/change-a-currency-symbol/

Here is the sample code that can help to change the currency symbol in each language. You need to add the code to the functions.php file of your theme.

add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
    
function change_existing_currency_symbol( $currency_symbol, $currency ) {
	$lang_code = apply_filters( 'wpml_current_language', null );
     switch( $currency ) {
           case 'KWD':           
              if($lang_code=='en'){
                  $currency_symbol = 'KWD'; 
              }else{
                 $currency_symbol = ' د.ك ';  
              }
           break;            
     }
     return $currency_symbol;
}

Please note that the provided code is a sample. You may need to modify it according to your specific requirements. Currently, we do not offer support for custom code on this platform. If you require specialized adjustments, we recommend contacting a developer from this link: https://wpml.org/contractors/

NOTE: Before making any changes, always make sure to take a full backup of the site.

Let me know if there is anything else you need help with. I will be happy to assist you.

Best Regards,
Prosenjit

September 7, 2023 at 10:42 am #14358521

Ahmed Sabbour

the issue is Arabic version of website not show any currency symbol and checkout process give message "Invalid currency code"

September 7, 2023 at 11:36 am #14358909

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,

May I kindly ask if you have tried the solution I shared in my last response?

If the issue persists even after that, a closer inspection will be required to understand the root cause of the issue. I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to share a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

IMPORTANT
-Please make a backup of site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Looking forward to your response.

Best Regards,
Prosenjit

September 8, 2023 at 5:15 am #14363417

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for sharing the credentials.

It seems the issue with the currency symbol is only happening on the checkout page created using Elementor. In my development environment, I checked by translating the default WooCommerce page and there the currency symbol appears properly. Please check this screenshot for a better understanding: hidden link

Now, I kindly request you to reproduce the same issue on our sandbox site provided below.

- hidden link

All the required plugins are already installed on the Sandbox site. You just need to install the Elementor PRO plugin and try to replicate the same issue in our sandbox site. In this way, we can isolate what exactly causing the issue and will be able to help you to find a solution promptly.

FYI, the code applied to change the currency in a different language is working now. The currency shows "SAR" in the English language.

Please let me know the update. We will be happy to help if you need further assistance in this matter.

Best Regards,
Prosenjit

September 8, 2023 at 12:53 pm #14366705

Ahmed Sabbour

Hello, thhank you for your reply, before taking this step, kindly note that I disabled the Elementor plugins and back to the default also, I removed the hook you sent earlier I just want to make that Arabic visitor able to check out. after all of that the problem is still exists

you can check by your self this sample product (hidden link) no currency symbol appear, try add to cart you will not find any currency symbol in the cart page, so the checkout process not complete

September 11, 2023 at 3:49 pm #14377955

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

my name is Marcel, and I am taking over your ticket as my colleague Prosenjit is unavailable today.

I also checked your site in English, and right now, It also shows "ر.س" instead of SAR. So the issue is also viewable when using your default language, both languages show "ر.س".

no currency symbol appear, try add to cart you will not find any currency symbol in the cart page, so the checkout process not complete

Therefore, I currently can't reproduce it any more. Did you re-activate the hook now?

Best Regards
Marcel

The topic ‘[Closed] currency not appear in Arabic version’ is closed to new replies.