The following three PageFragment components are used to render the Gift with Purchase links on the cart page and the gift selection pop-up. The page fragments are stored in the /DCS-CSR-UI/config/ directory:
atg/commerce/custsvc/ui/fragments/gwp
ChangeGiftListPageFragment– This fragment renders the Change Gift link next to an item when it contains a gift that has multiple choicesSelectGiftLinkPageFragment– This fragment renders a gift selection link for any gift that has not yet been added to the order. The fragment uses theGiftWithPurchaseSelectionsDropletto obtain theGiftWithPurchaseSelectionobjects for the current order. AnyGiftWithPurchaseSelectionthat is found with aquantityMissingFromOrdergreater than 0 will have a link rendered for it. If thegiftTypeiscategoryorcontentGroup, a selection link is rendered for each unit that is missing from the order. If thegiftTypeisskuorproduct, a single selection is rendered that adds the entire missing quantity to the cartSelectGiftPopupPageFragment– TheSelectGiftPopupPageFragmentis used to render the gift selection pop-up. It requires several input parameters for determining the gift choices and initializing theGiftWithPurchaseFormHandlervalues:itemId– Indicates which commerce item references the changed gift selection. The value is optionally provided to theGiftWithPurchaseFormHandlerpromotionId– The ID of the promotion. Required by theGiftWithPurchaseFormHandlerquantity– Required by theGiftWithPurhcaseFormHandler, this provides the quantity of the gift selectiongiftHashCode– Required by theGiftWithPurchaseFormHandler, this identifies the promotion hash codegiftType– Identifies the gift type, and is required for theGiftWithPurchaseSelectionChoicesDropletgiftDetail– Provides gift detail information and is required for theGiftWithPurchaseSelectionChoicesDroplet
For additional information on the GiftWithPurchaseSelectionChoicesDroplet, refer to the Core Commerce Programming Guide.
Should the agent proceed with checkout without first selecting eligible gifts for the order, the postMoveToPutchaseInfo method in the CSRCartModifierFormHandler will issue a message to inform the agent that the order qualifies for the gifts that are missing from the order.
The Core Commerce GWPManager queries all Gift with Purchase selections for the order. If any of them have a quantityMissingFromOrder greater than 0, an informational message is posted for the agent, such as “This order qualifies for a free gift that has not yet been selected.”
For additional information on Gift with Purchase configuration, refer to the Extending Objects for Cloning section.

