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:
None of the required fields (name, address, city, state, and postal code) are empty in any
ShippingGroup
.All of the commerce items in the
Order
are assigned to aShippingGroup
. This requirement must be met according to the following rules:If there is only one
ShippingGroup
in theOrder
and no relationships exist between thatShippingGroup
and the commerce items in theOrder
, then the shipping of all commerce items in theOrder
implicitly is accounted for by thatShippingGroup
.If there is only one
ShippingGroup
in theOrder
and relationships exist between thatShippingGroup
and the commerce items in theOrder
, or if there is more than oneShippingGroup
in theOrder
, then everyCommerceItem
in theOrder
must have its shipping explicitly accounted for with one or moreShippingGroupCommerceItemRelationship
objects, as follows:If a
CommerceItem
has aShippingGroupCommerceItemRelationship
of 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 theCommerceItem
that is not accounted for by other shipping relationships.If a
CommerceItem
has one or moreShippingGroupCommerceItemRelationship
objects of typeShippingQuantity
, but no relationship of typeShippingQuantityRemaining
, then the total quantity of theCommerceItem
covered by the relationships must be equal to or greater than the quantity in theCommerceItem
.The
range
property in theShippingGroupCommerceItemRelationship
identifies which particular items out of the total quantity of aCommerceItem
are associated with a givenShippingGroup
.Note: The priority of a
Relationship
in anOrder
, which is determined by the relationship’s type, plays a role in when theRelationship
is processed as theOrder
proceeds 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.