When an Order is first created, it has an empty ShippingGroup, which serves as the default ShippingGroup for the Order. The type of default ShippingGroup that is created is determined by the defaultShippingGroupType property of the OrderTools component. By default, this property is set to hardgoodShippingGroup in ATG Consumer Commerce and b2bHardgoodShippingGroup in ATG Business Commerce.
When a CommerceItem is added to the Order, that item is automatically a part of the default ShippingGroup because it is assumed that when there is only one ShippingGroup, all items are a part of that group. However, once a second ShippingGroup is added to the Order, the existing CommerceItem and any new commerce items must be explicitly assigned to one of the two shipping groups; any items that were in the default ShippingGroup are no longer a part of any ShippingGroup.
Before the Order is checked out, all of the order’s commerce items must be a part a ShippingGroup. This requirement is checked during the checkout process by the validateForCheckout pipeline, which is executed by the processOrder pipeline. Each processor in the validateForCheckout pipeline validates a different part of the Order as complete. The validateShippingGroupsForCheckout processor, in specific, validates the shipping groups in the Order. The shipping groups are considered complete if the following criteria are met:
None of the required fields (name, address, city, state, and postal code) are empty in any
ShippingGroup.All of the commerce items in the
Orderare assigned to aShippingGroup. This requirement must be met according to the following rules:If there is only one
ShippingGroupin theOrderand no relationships exist between thatShippingGroupand the commerce items in theOrder, then the shipping of all commerce items in theOrderimplicitly is accounted for by thatShippingGroup.If there is only one
ShippingGroupin theOrderand relationships exist between thatShippingGroupand the commerce items in theOrder, or if there is more than oneShippingGroupin theOrder, then everyCommerceItemin theOrdermust have its shipping explicitly accounted for with one or moreShippingGroupCommerceItemRelationshipobjects, as follows:If a
CommerceItemhas aShippingGroupCommerceItemRelationshipof typeShippingQuantityRemaining, then the item’s shipping is accounted for regardless of whether it has other shipping relationships. This is because a “remaining” relationship type covers any quantity of theCommerceItemthat is not accounted for by other shipping relationships.If a
CommerceItemhas one or moreShippingGroupCommerceItemRelationshipobjects of typeShippingQuantity, but no relationship of typeShippingQuantityRemaining, then the total quantity of theCommerceItemcovered by the relationships must be equal to or greater than the quantity in theCommerceItem.The
rangeproperty in theShippingGroupCommerceItemRelationshipidentifies which particular items out of the total quantity of aCommerceItemare associated with a givenShippingGroup.Note: The priority of a
Relationshipin anOrder, which is determined by the relationship’s type, plays a role in when theRelationshipis processed as theOrderproceeds through the checkout process. For more on relationship types and priority, see the Relationship Priority subsection of the Using Relationship Objects section in the Working With Purchase Process Objects chapter.
For more information on ShippingGroupCommerceItemRelationship objects, see the Relationship Types section in this chapter. For more information on the processOrder and validateForCheckout pipelines, see the Checking Out an Order section of the Configuring Purchase Process Services chapter.

