[TYPO3-shop] Tax calculation error (rounding problem?)

Franz Holzinger franz at fholzinger.com
Thu Dec 21 12:20:51 CET 2006


Hello Ryan,

> I'm having trouble with the tax calculations in the shop.  I've set 
> plugin.tt_products.TAXpercentage = 6.00, however, take the following 
> example:
> 
> Product P1 costs 1.20, P2 is 1.60.
> 
> 123*P1 + 456*P2 = 877.20
> 877.20*.06 = 52.632
> 
> The shop shows tax to be 54.21!
> 
> I'm not sure where the extra 1.578 went!

Your calculation is wrong.
The tax must be calculated and rounded for one product and not on the 
total end sum.

P1: 1.20 * 0.06 = 0.072   ~ 0.07
P2: 1.60 * 0.06 = 0.096   ~ 0.10

The tax calculation must not change if you order 1 product or 100.

123*P1 = 123 * 0.07 = 8.61
465*P2 = 465 * 0.10 = 45.60

total tax:  54.21

> If I only have 2 P2 (3.20), the calculated tax is 0.20 when it really 
> should be 0.192. It is rounded up instead of down.  Is this the expected 
> behaviour? 
P2: 1.60 * 0.06 = 0.096   ~ 0.10
This must be rounded up.

2 products have 0.20 tax. There must not be any tax reduction by 
rounding if you order more than one product.

- Franz




More information about the TYPO3-project-tt-products mailing list