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: WCML
Related documentation:
This topic contains 10 replies, has 2 voices.
Last updated by Waqar Ali 1 year, 10 months ago.
Assisted by: Waqar Ali.
Author | Posts |
---|---|
September 15, 2023 at 4:14 pm #14404431 | |
dejanP-12 |
Please check my site: hidden link WooCommerce V.8.0.3 When I change language from English (main language - EUR) to Bulgarian which is bounded to BGN Currency, BGN currency is rounded to 2 places behind decimal point and I get rounded price that is 10% of error. Price per unit is 0.028245 EUR , EUR is my main currency and I have no problem with rounding. If I use option "Set prices in other currencies manually" and set 0.055243745865 BGN then all is OK, no rounding and price is correct. For me is not easy to set manually price for each product in other currency and I wish that this problem is solved in currency module of WPML. Please what I can do to solve this problem with rounding other currencies different from main currency? |
September 18, 2023 at 2:07 pm #14412997 | |
Waqar Ali |
Hi, Thank you for contacting us and I'd be happy to assist. While adding/editing multiple currencies, you can control the rounding of the automatic price conversions, as explained in this guide: I hope this helps and please let me know if you need further assistance. regards, |
September 18, 2023 at 6:11 pm #14414803 | |
dejanP-12 |
Hi Ali, I know this option and rounding is disabled but this have not solved my problem. I think the problem is how WPML calculate price, it calculate price by decimals and not as it is really written to price field, my price is 0.055243745865 BGN and WPML use only two decimals places like 1000 x 0.05 = 50 BGN but the real price need to be 55.24 BGN If I use option in Woocommerce product "Set prices in other currencies manually" and set 0.055243745865 BGN then all is OK, no rounding and price is correct, it calculate it for 1000 pcs to 55.24 BGN. What is the solution, what can I do to solve this problem. |
September 19, 2023 at 3:02 pm #14420721 | |
Waqar Ali |
Thank you for sharing these details and I understand, what you mean now. I'll need to perform some tests on my website and will share the findings, as soon as it completes. Thank you for your patience. |
September 19, 2023 at 4:28 pm #14422499 | |
dejanP-12 |
Ok, thanks for quick response. I will waiting... |
September 22, 2023 at 6:32 am #14443539 | |
Waqar Ali |
Thank you for waiting as we had a busier than normal forum queue. Just wanted to let you know that I'm still working on this and will share the detailed findings, by the end of the day today. |
September 23, 2023 at 8:37 am #14450309 | |
dejanP-12 |
Ok, I am waiting... |
September 26, 2023 at 7:06 pm #14469217 | |
dejanP-12 |
Any news about my case? |
September 28, 2023 at 6:46 am #14478681 | |
Waqar Ali |
I've been trying to use some WooCommerce and WPML hooks to make this conversion and rounding work, but I haven't succeeded. I'm now working on a different custom shortcode approach and will share it with you as soon as it is ready. |
September 28, 2023 at 7:19 am #14478925 | |
dejanP-12 |
I really need it because the conversion simply doesn't work and my site is non-functional without it. I will wait for it, I hope it won't last long. Thanks |
October 3, 2023 at 4:12 pm #14507313 | |
Waqar Ali |
Thank you for waiting, as I completed some testing. I was able to achieve your desired automatic price conversion on my test website, by following these steps: 1. From WP Admin -> WooCommerce -> Settings -> General -> Number of decimals, I set the '6' decimal places for the default/primary currency (Euro). 2. And from WP Admin -> WooCommerce -> WooCommerce Multilingual & Multicurrency -> Multicurrency, I settled '1 EUR = 1.955877 BGN' with decimal places also set to '6'. As a result and as per your observation, the automatic price conversion started to work, as needed. 3. For the challenge of not showing the long price values on the front end with '6' decimal places, I used the 'formatted_woocommerce_price' filter, from WooCommerce: add_filter( 'formatted_woocommerce_price', 'custom_woo_decimal_price', 9999, 5 ); function custom_woo_decimal_price( $formatted_price, $price, $decimal_places, $decimal_separator, $thousand_separator ) { return substr($formatted_price,0,-3); } Note: You can include the above code snippet in your active child theme's 'functions.php' file. This way for calculations, the full price with 6 decimal places will be used, but for display, the price with only 3 decimal places will be used. |
October 6, 2023 at 12:32 am #14523549 | |
dejanP-12 |
I solved it on different way, I have written manually price for second currency in every product that have small price behind second decimal and it works. Thanks |