Double Order Totals in Magento

I’ve been having a problem in magento for a small number of customers where the order total is double what it should be – although everything looks correct in the basket. I haven’t been able to find the underlying cause, but hopefully have found a link to a fix which might help others having the same problem.

The fix is on this website here:
http://www.magentocommerce.com/boards/viewthread/227560/

The problem seems to be that magento is creating duplicate entries for a quote in the table: sales_flat_quote_address

It’s obviously not a very clean fix, but adding code to:
Mage\Checkout\Model\Cart.php

in the init() function after line: $this->getQuote()->setCheckoutMethod(”);


$addresses = $this->getQuote()->getAllAddresses();
				
if (count($addresses) > 2) {
  for($i = 2; $i < count($addresses); $i++) {
    $address = $addresses[$i];
    $address->isDeleted(true);
  }
}

The verdict is out so far, but hopefully that should do the trick.

If you are allowing multiple shipping addresses for an order, this probably won’t work for you.