PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Price Rounding Issue

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello,

I have a big problem.

On my online store, prices are in euros, and I use Fox Currency Switcher to convert them to different currencies. There are never any problems with euros, but with other currencies, there are sometimes issues (not all the time). The decimal point is misaligned. For example, a customer places an order for CA$49.90 + CA$209.90 worth of products + CA$122.21 shipping. That's a total of CA$382.01. The converted prices look normal on the product page and also on Stripe. I've even checked the Stripe logs, and everything is fine. But on the order page, there's an error. I've included a screenshot below. 49.90 becomes 499.00, 209.90 becomes 2099.00, and the delivery fee of 122.21 becomes 12221.00.

Our customers always panic when this happens and even dispute charges on their credit cards because of it.

Here is the code for rounding that I put in functions.php. Is it correct? Could it be the source of the problems?

// Arrondi des prix sauf pour HUF et EUR
add_filter('woocs_raw_woocommerce_price', function($price) {
global$WOOCS;
if (in_array($WOOCS->current_currency, ['HUF', 'EUR'])) {
return$price;
}
if (is_admin()) return$price;
$is_product_context = false;
if (is_product() || is_shop() || is_product_category() || is_product_tag()) {
$is_product_context = true;
}
if (did_action('woocommerce_before_calculate_totals')) {
$is_product_context = true;
}
if ($is_product_context) {
if ($price < 10) {
$rounded = round($price); // Arrondi à l’entier
} else {
$rounded = round($price / 10) * 10; // Arrondi à la dizaine
}
$adjusted = $rounded - 0.10;
returnmax(0, $adjusted);
}
return$price;
});
// Arrondi spécial pour la devise HUF à x90 HUF
add_filter('woocs_raw_woocommerce_price', function($price) {
global$WOOCS;
if ($WOOCS->current_currency !== 'HUF') {
return$price;
}
if (is_admin()) return$price;
$is_product_context = false;
if (is_product() || is_shop() || is_product_category() || is_product_tag()) {
$is_product_context = true;
}
if (did_action('woocommerce_before_calculate_totals')) {
$is_product_context = true;
}
if ($is_product_context) {
$rounded = round($price / 100) * 100;
$adjusted = max(0, $rounded - 10);
return$adjusted;
}
return$price;
}, 20);

Or is it because the euro uses commas to separate decimals and the Canadian dollar uses periods? I'm really lost.

Thank you for your help,

Camille

 

Hello Camille

  1. In the plugin options select divider for CAD please https://share.pluginus.net/image/i20260123130608.png
  2. Remove your customizations to see if all is right
  3. Make test order (no stripe, but card or bank, or stripe but with sandbox account)
  4. If no luck create please site clone using duplicator https://wordpress.org/plugins/duplicator/ and in the private are provide wp-admin + ftp access there
  5. temporary disable in tab Advanced 'Is multiple allowed' and use only basic currency

https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png