laravelshoppingcart icon indicating copy to clipboard operation
laravelshoppingcart copied to clipboard

Rounding error when adding condition per item

Open ezani92 opened this issue 6 years ago • 2 comments

Screen Shot 2019-11-26 at 6 21 20 PM

based on the screenshot above. you will see the subtotal is wrong. how to fixed this.

getPriceSumWithConditions() should output 3.09 but its rounding to 3.08

ezani92 avatar Nov 26 '19 10:11 ezani92

0.97 * 1.06 = 1.0282 we round this to 1.03

i have quantity 3 so, 1.03 * 3 = 3.09

================= but the package calculate like this 0.97 * 1.06 * 3 = 3.0846 round to 3.08

please help thanks

ezani92 avatar Nov 26 '19 10:11 ezani92

This issue is still there. I started figuring out why this happening & I comes to know that there is a apply method inside Darryldecode\Cart\CartCondition class.

image

This result variable should be wrapped inside round($result, 2) so it round up the amount up to 2 decimal. Any suggestion on this would be appreciated.

iamharis010 avatar Aug 20 '21 06:08 iamharis010