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.

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:

  1. None of the required fields (name, address, city, state, and postal code) are empty in any ShippingGroup.

  2. All of the commerce items in the Order are assigned to a ShippingGroup. This requirement must be met according to the following rules:

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.