Yes, you can tweak and round function on line 343 of the code and fix it as needed.
` if($extra_charges_type_value==”percentage”){
$t1 = (($totals -> cart_contents_total+$totals->shipping_total)*$extra_charges)/100; }else{
$t1 = (($totals -> cart_contents_total+$totals->shipping_total)*$extra_charges_rpct)/100;
}
Thread Starter
alexio
(@alexio)
Hi,
It’s rounding up my Fixed price not the percentage price!
The code you quoted is for the percentage values as far as i can tell.
Here are my settings:
http://snap.ashampoo.com/uploads/2019-11-25/rXefDVBA6kw7TwCD40xVphSYVWjqEr5VkB3Nx7OUIFt55VAzVyqFaD0V2IhaZEVf.png
And checkout page with rounded up extra charge.
http://snap.ashampoo.com/uploads/2019-11-25/ZNVQBl2SBqkdMPs5eOcT3zlt0nyLTG9ouvawB3kdmuGYfYwJIY7ESJySWr0Ly91N.png
Is the plugin supposed to be working like this? I’m i missing something?
Thanks again
-
This reply was modified 6 years, 6 months ago by
alexio.
Hi,
The fixed price does not round anything. Please check ur wp install & also see the results in the below link from my test servers.
https://prnt.sc/q23vux
Thread Starter
alexio
(@alexio)
Hi,
Thanks for the info, must be something wrong with my installation, sorry to bother you.
— I figured out my mistake. I will write the solution just in case someone else needs it.
I wanted the decimal zero’s to be hidden from the product prices and i changed the setting of woocommerce, “number of decimals”, to zero. Since there where no decimals to show, it automatically rounded up my 2.5 euros extra charge to 3.
I reset the number of decimals to 2 and used a filter on functions.php to hide the decimal zeros and everything works great.
add_filter( 'woocommerce_price_trim_zeros', '__return_true' );
-
This reply was modified 6 years, 6 months ago by
alexio.