Magento bug. Wrong totals (+ 1-2 cents)ΒΆ

Magento for some reason adds additional 1-2 cents to totals. In order to fix this, locate the file app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php and the function below:

public function calcRowTotal()
{
    $qty        = $this->getTotalQty();
    $total      = $this->getStore()->roundPrice($this->getCalculationPriceOriginal()) * $qty;
    $baseTotal  = $this->getStore()->roundPrice($this->getBaseCalculationPriceOriginal()) * $qty;

    $this->setRowTotal($this->getStore()->roundPrice($total));
    $this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
    return $this;

}

and replace it with the function:

public function calcRowTotal()
{
    $qty        = $this->getTotalQty();
    // Round unit price before multiplying to prevent losing 1 cent on subtotal
    //$total    = $this->getStore()->roundPrice($this->getCalculationPriceOriginal()) * $qty;
    $total      = $this->getCalculationPriceOriginal() * $qty;
    $baseTotal  = $this->getStore()->roundPrice($this->getBaseCalculationPriceOriginal()) * $qty;

    $this->setRowTotal($this->getStore()->roundPrice($total));
    $this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
    return $this;
}

Should you have any questions on this article or would like to learn more about our Magento plugins, Magento 2 extensions or services, we will be more than happy to help. To submit your request, please follow this link.