Home›Support›English Support›[Resolved] The currency converter does not convert currency for some products
[Resolved] The currency converter does not convert currency for some products
This thread is resolved. Here is a description of the problem and solution.
Problem: You are experiencing issues with the currency converter on your WooCommerce site, where the currency symbol changes but the amount does not convert correctly for some products. This issue arises because the prices are stored in the wp_postmeta table using comma separators instead of decimal points, which prevents them from being recognized as numbers suitable for calculations. Solution: To resolve this, you need to correct the format in which prices are stored: 1. For simple products, simply re-save each product. This action will update the price format in the wp_postmeta table to the correct decimal point format. 2. For variable products, re-saving the parent product alone will not suffice if the prices are not altered. You must change the price of each variation slightly to trigger the update in storage format. We have created a video to guide you through these steps, which you can view here: Video Guide.
Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket with us for further assistance.
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.
Background of the issue:
I am trying to update the product, clear the cache, change the template to the factory one, and disable plugins to resolve an issue with the currency converter. The issue can be seen on this page: hidden link.
Symptoms:
The currency converter does not convert currency for some products, just the symbol change
Thank you for your time. I'd appreciate it if you could confirm if the issue is happening on price range (variable) products only, or even the simple products with specific prices have the same issue.
If so, I'd appreciate it if you could provide login to staging version of the website (not live website) so we can do some investigative work there to identify the problem cause.
You can set the next reply a private to provide the info.
Also it will help if you can provide 2-3 more products that do not work for testing.
Thank you for the login info. I managed to login and checked the issue and there is a problem that you can test here:
hidden link
If you go to the edit screen of the product and then click the Variations tab, and click on one of the variations you will see that the price item there is empty (check the screenshot)
That is like that for all other variation items.
So there is no price in Hungarian version in the first place for WPML to be able to do any sort of calculation for the converted currency.
Please test by adding prices for each variation in HUF and you save the product. Then make sure the translation is 100% complete for other languages and then the conversion should work.
Thank you very much. You are correct the variations have the regular price.
Would you please test if the same thing happens on a minimal installation?
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Wooocmmerce, Woocomemrce Multilingual, WPML Multilingual CMS, WPML String Translation
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.
If the issue still happens, we will need your permission to copy your website ot our server for further investigation.
Thank you for your patience. I have an answerr from the second tier support.
Checking on a vanilla test site I can confirm that if your WooCommerce settings are to use a , as the decimal separator WC stores the price in wp_postmeta with a . decimal point separator regardless (i.e. as something a computer recognises as a number so that calculations can be performed on it, e.g. adding a percent tax).
The , is only ever used for display purposes.
But on your site the prices are wrongly stored in the postmeta table using comma separators, so as far as a computer is concerned they are not numbers and they cannot be used in calculations (e.g. to another currency). This doesn't affect some products whose prices are whole numbers and which therefore do not use a decimal separator, and recalculating their price works.
I don't know how the you ended up with prices stored in wp_postmeta in the wrong format, I imagine you may have imported them? Or perhaps some other plugin is involved.
To fix the problem of converting the prices the original prices themselves need to be fixed.
For simple products it is enough to re-save them: how the price is stored in wp_postmeta will be updated to the correct format.
I found that this didn't work with variable product prices, it seems if the price isn't changed then re-saving the parent product doesn't update how the prices are stored, and it is necessary to make a change to the price to each variation.