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

Rounding prices doesn't work properly

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.

I'm trying to round down prices to convert for example 695,18 ARS to 599 ARS. I mean, rounding down two digits minus 1 to make the price more attractive.

To do that I'm using this code:

add_filter('woocs_raw_woocommerce_price', function($price) {
global $WOOCS;

if ($WOOCS->current_currency == 'ARS' ) {
return floor($price / 100) * 100 - 1;
} else {
return $price;
}
});

add_filter('woocs_woocommerce_variation_prices', function($price) {
global $WOOCS;

if ($WOOCS->current_currency == 'ARS') {
return floor($price / 100) * 100 - 1;
} else {
return $price;
}
});

I'm using this snippet and this other one as reference.

The issue is that sometimes the prices are rounding down as expected (599 ARS), but other times I can see the converted price with no rounding (695,18 ARS).

You can test this issue on any of these categories:

https://leandroperez.art/tienda/categoria/talleres/

https://leandroperez.art/tienda/categoria/cursos/

Hello

I  did  a test - https://c2n.me/4abvYBG - everything seems to be working correctly

Please check the individual products, that's where the issue can be seen properly.

Hello

Ok!  Drop  me  exact link  to  the  product  with  the  issue

My  test - https://c2n.me/4adsdwd

This one should show AR$599 but when quickly changing from one"clase" to another you'll some something like AR$695,18

https://leandroperez.art/tienda/cursos/curso-de-captura-y-edicion-de-timelapse-de-dia-a-noche/

 

This other one should show AR$1.699 for the cheapest variation but when selecting the dropdown option you'll see AR$1.599 (plus sometimes the font looks bigger, I'm not sure why).

https://leandroperez.art/tienda/talleres/fotografia-nocturna-de-paisaje/

 

Hello

Where  you  add  this  code?

Try  to  do a  test  with -  https://c2n.me/4aeub8f.png

I'm using the code on a custom plugin called funciones.php, line 711.

I have that cache option enabled as well since the day I installed Currency Switcher.

Hello

Add  to  functions.php  of the  current theme and do a test

I moved the code but unfortunately the issue is still there.

Hello

For some reason, this custom code does not work in ajax mode( https://c2n.me/4agjSsT.png ).

OR  third-party code changes prices in ajax mode. For example, plugins for discounts, extra cost, taxes

 

Oh, that's too bad. Hope you can fix it in future updates of the plugin.

Hello

 Hope you can fix it in future - ??? - the problem is not related to our plugin. Most likely there is a problem with your website.

Oh, I misunderstood.

Since you said the custom code doesn't work with AJAX I thought maybe it was something related to the Currency Switcher plugin.

Hello

the custom code doesn't work with AJAX  - Yes, but only on your website