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.
WordPress 6.7 has introduced a new issue that impact translations, please update WooCommerce and WPML to the latest versions before you report issues. More about this here - https://wpml.org/errata/php-error-wp-6-7-notice-function-_load_textdomain_just_in_time-was-called/
Problem with rounding on 2 decimal on frontpage. pict1 ju see the price 10,92€, on pict2 is set to see 3 decimal and the price is 10,926€. Correct rounding on 2 decimal will be 10,93€. I have Slovak comparator Heureka and this plugin give me price (€) from wpml:
<PRODUCT>
<![CDATA[ Zámečnické kladivo, 800 g ]]>
</PRODUCT>
<PRICE_VAT>10.93</PRICE_VAT>
As you see rounding is correct. But admins from heureka don't want to start my eshop, because the price must be on 2 decimal correct inside the feed and on the frontpage.
Can you help me? Primary language is Czech (CZK) and the seccond is Slovak (€).
What do you have set for the rounding settings for that currency?
Go to the Multicurrency tab of WooCommerce > WooCommerce Multilingual & Multicurrency, and you should be able to see settings for rounding, as in the screenshot.
I can see in our codebase that we use floor rather than round to calculate the price to the specified number of decimal places in secondary currencies. (I'm not sure why, I suspect it was a simplification relating to older versions of PHP.)
It's not something that can be adjusted via filter, until this is fixed in the plugin if you want it to round to the nearest decimal you will need to make a small change to the plugin files.
You will need to edit the file plugins/woocommerce-multilingual/inc/currencies/class-wcml-multi-currency-prices.php.
Locate these lines (around line 481):
// Use configured number of decimals.
$price = floor( $price * pow( 10, $currency_options['num_decimals'] ) + 0.0001 ) / pow( 10, $currency_options['num_decimals'] );
and replace that with
// Use configured number of decimals.
$price = round( $price, $currency_options['num_decimals'] );
I'll leave this thread as escalated and when I get notice that the issue is fixed I'll let you know.