HandlingInstruction
objects are constructed using one of the createHandlingInstruction()
methods in the HandlingInstructionManager
. After the object is created and populated with the required data, call the addHandlingInstructionToShippingGroup()
method to add the handling instructions to the ShippingGroup
that contains the commerce item(s) whose IDs are specified in the HandlingInstruction
.
A customer can set more than one handling instruction for a given CommerceItem
in a ShippingGroup
. For example, if an Order
contains a single CommerceItem
that was added to a user’s shopping cart from another user’s gift list and needs to be gift wrapped, two HandlingInstructions
must be created – one for the gift wrapping and another for the gift list. Each HandlingInstruction
would be of a different class type: GiftwrapHandlingInstruction
and GiftlistHandlingInstruction
, respectively. Each HandlingInstruction
would contain:
The ID of the
ShippingGroup
that contains theCommerceItem
.The ID of the
CommerceItem
to which the handling instruction applies.A quantity of 1.
Any other necessary fields of
GiftwrapHandlingInstruction
andGiftlistHandlingInstruction
.
The sum of HandlingInstruction
quantities cannot exceed the quantity in the ShippingGroup
for a particular HandlingInstruction
class. In the above example, there can be only one GiftwrapHandlingInstruction
with a quantity of 1 in the ShippingGroup
because there is only one item in the ShippingGroup
. However, there can be a GiftlistHandlingInstruction
in the ShippingGroup
that references the same item because the two HandlingInstruction
objects are different types.
For details on GiftListHandlingInstructions
, see the Configuring Commerce Services chapter.