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.

7 Replies to “Double Order Totals in Magento”

  1. Hi Dave, did you find out why this was happening by any chance? I’m seeing the same issue so thought I’d ask before I start trawling through code!

    Cheers,
    Mike

  2. Hi Mike,

    Sorry I haven’t found the underlining cause, and I haven’t been able to replicate it. It was getting reported quite often, but since the fix above it’s very occasionally. If you find something I’d be all ears,

    best regards,

    David

  3. Hey Guys,

    I’ve been perplexed by the above problem but seem to have found a way to resolve this.

    Under Shipping Settings > Maximum Qty Allowed for Shipping to Multiple Addresses –> Set the value to “0” . At the same time, your “Allow shipping to multiple address” is “NO”.

    I have tried this and logged in to my customer’s accounts who had this problem and it seemed to work. Also, this only happens to customers who have multiple shipping addresses.

    Please help verify if the above works for u too! Appreciate it. Thanks.

    1. Hi Andrew, thanks for the reply – I’ve currently got “Allow Shipping to Multiple Addresses” set to no, but the “Maximum Qty Allowed for Shipping to Multiple Addresses” is set to 100 (I think that’s the default) – next week I’ll try setting this to 0 and let you know. Were you able to replicate the problem yourself in testing? Thanks again, David

  4. Hi David,

    Yes I was able to replicate the problem by logging in to my customers account and perform a add to cart. It seems to affect customers who have more than 1 shipping addresses. If I delete the extra shipping addresses, the add to cart stops doubling.

    Indeed 100 is the default, out of curiosity I changed the value to 0 and it seems to work. I haven’t don’t much testing, but if it works for u too do let me know!

    Thanks man

  5. Does anybody have any update on this? I have been seeing the problem sporadically, but the customers only have one shipping address in my case. I’m not sure if it is browser specific, as I don’t have that information. It just seems to happen every now and then that the cart price is doubled. I had a customer that this happened to, she removed her products, added them to the cart again and had no problem. Obviously not everybody is going to go to this trouble, they will just abandon their cart!

Leave a Reply

Your email address will not be published. Required fields are marked *