laravelshoppingcart icon indicating copy to clipboard operation
laravelshoppingcart copied to clipboard

Wrong subtotal + total sum

Open lucassimines opened this issue 4 years ago • 1 comments

Hi, I'm experiencing an issue on the getTotal value.

When the cart tries to sum the product with a value of 427.67 + 35.4 it returns 462.66999999999996

See the image below of the Cart response.

Screen Shot 2021-01-22 at 13 38 18

lucassimines avatar Jan 22 '21 16:01 lucassimines

This is probably because the package seemingly uses floats for pricing. And as such is subject to a number of rounding issues. Ideally there would be an integer representing the amount in minor units. (Ie. 82.54 usd would be 8254 cents).

ovp87 avatar Mar 26 '21 21:03 ovp87