This thread is resolved. Here is a description of the problem and solution.
Problem:
The client needed to display the currency code as "AED" in English and "د.إ" in Arabic on their WooCommerce website.
Solution:
We recommended using the
wpml_current_language
filter hook to determine the current language and then display the appropriate currency code. Here is a step-by-step guide:
1. Add a filter to the
woocommerce_currency_symbol
.
2. Use the
wpml_current_language
filter to get the current language.
3. Depending on the language, set the currency symbol to "AED" for English or "د.إ" for Arabic.
Here is the example code:
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 'AED': if( $my_current_lang == 'en' ) { $currency_symbol = 'AED'; } else{ $currency_symbol = 'د.إ'; } break; } return $currency_symbol; }
We also informed the client that custom code assistance is beyond the scope of WPML support and suggested contacting one of our certified partners if they need further help with the implementation.
Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If this solution does not solve your issue, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
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 is split from https://wpml.org/forums/topic/checkout-field-editor-for-woocommerce-with-wpml/
This topic contains 1 reply, has 2 voices.
Last updated by 9 months, 2 weeks ago.
Assisted by: Long Nguyen.