Problem

If you run the Line Item Migration more than once (say you're doing an update, or some value was missed for example), the line item entity is added twice to the same order and throws off the order total.

Reason

CommerceMigrateUbercartLineItem::complete() has code that will blindly attach the line item to its order. This is needed the first time through, but after that it's a problem.

Solution

Check to see if that line item has already been attached to its order. If so, skip the rest of the complete() function.

Patch

Patch attached will loop through existing line item values on an order and if it finds a match will bail out of complete(). Improvements are welcome, I don't know if there's an easier way to interact with the commerce_line_items array than using the getIterator().

Comments

kscheirer’s picture

Issue summary: View changes
dwkitchen’s picture

Status: Needs review » Fixed

  • dwkitchen committed a4885c4 on 7.x-2.x authored by kscheirer
    Issue #2299177 by kscheirer: Duplicate line items on orders when...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.