Magento – Magento Tax Calculation BUG

magento-1.9shipping-taxtax

I think I've found magento bug and I just want to know if I'm right here:

Order:
subtotal(without tax) € 35,72

discount – € 0,71

Shipping cost: € 6,00

Subtotal excldued tax € 41,05 (should be 41.01)

VAT 6.0% (6%) € 2,10

VAT 21.0% (21%) € 1,26

VAT TOTAL: € 3,36

GRAND TOTAL € 44,41 (should be 44.37)

41.05 had 4 cents added extra…
those 4 cents is the difference between tax value
2,14euro (before discount)
2,10euro (after discount).

Best Answer

I am not sure if this would help you somehow, but I think that you can calculate with these two files, or modify the functions:

Tax subtotals file calculation is done here:

magento\app\code\core\Mage\Tax\Model\Sales\Total\Quote\Subtotal.php

public function collect(Mage_Sales_Model_Quote_Address $address)
    {

There you have round functions used:

Further magento takes these functions from this file:

\magento\app\code\core\Mage\Tax\Model\Calculation.php

Check these functions:

public function round($price)
    {
        return Mage::app()->getStore()->roundPrice($price);
    }

    /**
     * Round price up
     *
     * @param   float $price
     * @return  float
     */
    public function roundUp($price)
    {
        return ceil($price * 100) / 100;
    }

    /**
     * Round price down
     *
     * @param   float $price
     * @return  float
     */
    public function roundDown($price)
    {
        return floor($price * 100) / 100;
    }

I am not sure if this is the right answer, but hopefully this can get you somewhere. Because magento pricing is quite complex.

Related Topic