This thread is resolved. Here is a description of the problem and solution.
Problem:
The client needed a way to display the currency code instead of the symbol across various sections of their WooCommerce site, including product pages, store, cart, and checkout.
Solution:
We recommended a temporary solution to display the currency code everywhere on the site. Here are the steps we suggested:
1. Take a backup of your site and database.
2. Edit your active theme's functions.php file.
3. Add the following code at the end of the file:
add_filter( 'woocommerce_currency_symbol', function( $currencySymbol, $currency ) { return $currency; }, 10, 2 );
4. Save the changes and check on the frontend.
Additionally, if you want to edit the currency switcher:
1. Go to WooCommerce -> WooCommerce Multilingual & Multicurrency -> Multicurrency.
2. Scroll down to "Product page Currency Switcher" section.
3. Edit the currency switcher and remove "%symbol%" from "Template for currency switcher" field.
4. Save the changes.
For more details on managing multi-currency in WooCommerce, please see our documentation.
If this solution does not apply to your case, or if it becomes outdated, we 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. Should you need further 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.
Tagged: Feature request
This topic contains 11 replies, has 0 voices.
Last updated by Florencia-2 1 day, 8 hours ago.
Assisted by: Waqas Bin Hasan.
Author | Posts |
---|---|
November 26, 2024 at 5:28 pm #16446494 | |
Florencia-2 |
Background of the issue: Symptoms: Questions: |
November 27, 2024 at 6:43 am #16447521 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Thank you for contacting the support. Before proceeding further, may I ask for the debug information of your website for an overview of your setup? See https://wpml.org/faq/provide-debug-information-faster-support/ for more information. I've enabled the debug information section for your next reply. Additionally you can also take a look at https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/ and cross-check for a few initial fixes. See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security. Regards. |
November 27, 2024 at 7:42 am #16447705 | |
Florencia-2 |
Please find the debug information attached to this message. thanks |
November 27, 2024 at 10:08 am #16448534 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the debug information. I'll recommend updating WordPress and WPML plugins to the latest version, then clear all caches, resave multicurrency settings and check again. IMPORTANT: Please take full backup of your website and database beforehand. It is highly advised to try this on a staging/dev site first, so your live website isn't compromised. If this does not resolve the issue, then please share the screenshots of the currencies set in WCML for review. Please let me know and I'll try my best to help you further on the matter. |
November 27, 2024 at 10:49 am #16448697 | |
Florencia-2 |
Hello. This is not a bug, so updating WordPress and plugins won't do anything. This is what I am trying to explain: WHICH MEANS: BUT THE PROBLEM IS: in this case we are talking about a website that operates internationally with different currencies, so having the symbol "$" for many currencies is bad, because it's unclear which currency is being used during the cart and checkout process. And even after the user has made the payment, if we go to the order details, we just see amount expressed with the "$" symbol (without the currency code), so we can't know which currency the user paid in. TO REPLICATE THIS ISSUE: you can create any staging site and activate WPML multicurrency. Then, in the settings, add a few currencies (for example, US dollar, Argentinian peso, Colombian peso, and Mexican peso). You will see what I mean: all of them are expressed as "$" in the front end (as opposed to having USD, ARS, CLP, MXP, which are the currency codes) |
November 27, 2024 at 12:08 pm #16448946 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. I am working again on this and 'll get back to you as soon as I've an update. |
November 28, 2024 at 8:06 am #16453258 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I've reproduced it in a sandbox site and checking with my team and 'll update you accordingly. |
November 28, 2024 at 11:16 am #16454541 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our team has registered it as a feature request but there's no ETA for this so far. However, they've provided the following temporary solution, which 'll show currency code (instead of symbol). But please note that it 'll be displayed everywhere (i.e. product page, store, cart, checkout and etc). - Take backup of your site and database. add_filter( 'woocommerce_currency_symbol', function( $currencySymbol, $currency ) { return $currency; }, 10, 2 ); - Save and check on frontend. I've tested this in my sandbox site at following: |
November 28, 2024 at 12:28 pm #16454961 | |
Florencia-2 |
Hi, thank you so much for your help. I implemented that code, and it did exactly what I needed. I just have one thing that I would like to improve: the widget (dropdown) now shows the currency in the format that you can see in the screenshot attached. For example, the dropdown says: Chilean peso (CLP) - CLP This looks very repetitive (because each currency has the currency code twice). Is it possible to get rid of the duplicate currency code? For example: Instead of showing "Mexican peso (MXN) - MXN" I would like to have "Mexican peso (MXN)" or "Mexican peso - MXN" |
November 28, 2024 at 1:07 pm #16455184 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Yes you can do that by editing the currency switcher: - Go to WooCommerce -> WooCommerce Multilingual & Multicurrency -> Multicurrency. |
November 28, 2024 at 1:15 pm #16455253 | |
Florencia-2 |
The "Product page currency switcher" doesn't work in my case, so I am using the shortcode [currency_switcher] instead. In that case, how can I remove the duplicate currency symbol? |
November 28, 2024 at 1:19 pm #16455264 | |
Waqas Bin Hasan Supporter
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Please see https://wpml.org/documentation/related-projects/woocommerce-multilingual/multi-currency-support-woocommerce/#currency-switcher-shortcode for details. |
November 28, 2024 at 2:03 pm #16455590 | |
Florencia-2 |
Thank you so much! This is exactly what I needed. |