Sep-20-2019, 04:14 PM
Hello,
wondering if anybody has some experience with prices + tax calculation?
I've been dealing with a following problem:
I am supposed to display product prices in cart already with tax included, but
let's say a product price without tax:
two products:
but rounding gets me to 689.87 which I guess can be confusing for customer. Also I need to add tax
on the "total price" and not to every product individually because, sometimes I need to do some
discount subtractions on total_price without tax.
Any tips?
Thanks in advance
wondering if anybody has some experience with prices + tax calculation?
I've been dealing with a following problem:
I am supposed to display product prices in cart already with tax included, but
let's say a product price without tax:
quantity = 1 price_without_tax = 285.07 tax = 1.21 # 21%so that means I should display product price with tax:
price_with_tax = price_without_tax * quantity * tax # 344.93469999999996 price_with_tax_rounded = Decimal(price_with_tax).quantize(Decimal('.01'), rounding=ROUND_UP) # 344.94So the price I display for product is 344.94. The problem is that if I do the same calculation for
two products:
quantity = 2 total = price_without_tax * quantity * tax # 689.8693999999999I would like to get to get to price = 689.88 which would make sense,
but rounding gets me to 689.87 which I guess can be confusing for customer. Also I need to add tax
on the "total price" and not to every product individually because, sometimes I need to do some
discount subtractions on total_price without tax.
Any tips?
Thanks in advance