The standard process for merging orders involves OrderManager.mergeOrders() calling CommerceItemManager.mergeOrdersCopyCommerceItem() to copy existing commerce items from a source order to a destination order, and calling ShippingGroupManager.mergeOrdersCopyShippingGroup to copy existing shipping groups from the source order to the destination order. In the ShippingGroupManager, mergeOrdersCopyShippingGroup, in turn, calls either mergeOrdersCopyHardgoodShippingGroup or mergeOrdersCopyElectronicShippingGroup, depending on the type of the shipping group.
However, if you’ve extended certain ATG Commerce classes to store additional information, you must change the methods used for merging orders so the additional information is copied to the destination order when merging orders.
If you’ve extended
CommerceItem, you should subclassCommerceItemManagerand override themergeOrdersCopyCommerceItemmethod to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve extended
HardgoodShippingGroup, you should subclassShippingGroupManagerand override themergeOrdersCopyHardgoodShippingGroupmethod to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve extended
ElectronicShippingGroup, you should subclassShippingGroupManagerand override themergeOrdersCopyElectronicShippingGroupmethod to first call the superclass method to do the basic copy and then copy your extended commerce item data.If you’ve created a new shipping group type that is neither a subclass of
HardgoodShippingGroupnorElectronicShippingGroup, you should subclassShippingGroupManagerand override themergeOrdersCopyShippingGroupmethod to examine the class of the shipping group. If the shipping group is of the new type you created, then the subclass should copy it to the destination order. Otherwise, the method can call the superclassmergeOrdersCopyShippingGroupmethod to handle the standard shipping group types.

