This thread is resolved. Here is a description of the problem and solution.
Problem:
The client wanted to translate the currency symbol from 'EGP' to 'جنيه' using string translation, but it was not working.
Solution:
We informed the client that currency symbols are managed by WooCommerce and there are limitations to translating them directly through string translation. However, we provided a solution using WooCommerce hooks to change the currency code. We directed the client to the WooCommerce documentation on how to change a currency symbol and provided sample code to be placed in the
functions.php
file of their theme after ensuring a full site backup.
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2); function change_existing_currency_symbol( $currency_symbol, $currency ) { switch( $currency ) { case 'EGP': if(ICL_LANGUAGE_CODE=='en'){ $currency_symbol = 'EGP'; }else{ $currency_symbol = ' جنيه '; } break; } return $currency_symbol; }
We asked the client to try this solution and provide feedback.
If this solution does not apply to your situation, or if it seems outdated, we recommend opening a new support ticket. We also highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please contact us through the WPML support forum.
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 4 replies, has 2 voices.
Last updated by 4 years, 5 months ago.
Assisted by: Bigul.