The Gift with Purchase feature extends the base marker repository definitions to provide gwpOrderMarker and gwpCommerceItemMarker item types. Each gwpOrderMarker represents a single gift selection. Each gwpCommerceItemMarker tracks the quantities of that commerce item which was auto-added, selected, or targeted by a Gift with Purchase promotion.

Gift with Purchase markers only persist while the order still qualifies for the promotion. If the promotion no longer applies, associated markers are removed.

The gwpOrderMarker item type has the following properties:

Property

Data Type

Description

key

String

This value is always atg.gwp.

value

String

The promotionId.

data

String

Hash code to track which gift selection in the promotion this is. It allows the commerce item marker to link to this marker. A hash of the PMDL discount detail for a single gift selection given by the promotion.

giftType

String

The type of gift, which can be sku, product, category, skuContentGroup, or productContentGroup.

giftDetail

String

String identifying the gift, usually the repository ID of the gift type.

autoRemove

boolean

Flag to indicate whether free gifts should be auto removed if the promotion no longer qualifies. This is configured by the merchandiser when the promotion is created.

quantity

long

The total quantity of SKU for this gift selection, this is the quantity from the PMDL multiplied by the number of times the offer applied (if it applied more than once).

automaticQuantity

long

The quantity of free SKU for this gift selection that has already been auto added to the order.

targetedQuantity

long

The quantity of free SKU for this gift selection that has already been targeted and made free by the calculator in the order.

selectedQuantity

long

The quantity of free SKU for this gift selection that has already been selected by the Shopper and added to the order.

removedQuantity

long

The amount of the free quantity that has been manually removed by a shopper. Keeping track of removed quantities prevents them from being automatically re-added in future pricing operations. The assumption is that the customer does not want the free item.

failedQuantity

long

Tracks any gifts that should have been automatically added but failed, for example due to a site conflict with the promotion.

The key, value and data properties are required to look up marker objects. The combined value and data properties are unique for a given gwpOrderMarker.

The automaticQuantity, targetedQuantity and selectedQuantity properties keep track of the different ways that a free quantity of SKU can be in the cart. The quantity of SKU the shopper still needs to select via a placeholder item can be determined via the following expression:

quantity - (automaticQuantity + targetedQuantity + selectedQuantity +
removedQuantity + failedQuantity).

The gwpCommerceItemMarker repository item has similar properties, as shown in the following table:

Property

Data Type

Description

key

String

The value is always atg.gwp.

value

String

The promotionId.

data

String

The gift hash code for the promotion, a hash of the PMDL discount detail for a single gift selection given by the promotion.

targetedQuantity

long

The quantity of the free gift that this commerce item is making free and was targeted by pricing.

automaticQuantity

long

The quantity of the free gift that this commerce item is making free and was auto added by pricing.

selectedQuantity

long

The quantity of the free gift that this commerce item is making free and was selected by the shopper.

remainingQuantity

long

The total quantity of the commerce item that doesn’t apply to this gift. Used to detect when a commerce item quantity is removed to ensure the gift quantities are updated correctly.

The value and data properties are used to match the gwpCommerceItemMarker to the related gwpOrderMarker that relates to this commerce item marker.

The targetedQuantity, automaticQuantity and selectedQuantity track how much of the total quantity of the gift is provided by the commerce item. Multiple commerce items can contribute to the total quantity. For example, a Gift with Purchase promotion could offer a free gift of two watches. The shopper selects two different watches, creating two commerce items. Each commerce item has an associated gwpCommerceItemMarker, each of which refers to the same gwpOrderMarker. Each gwpCommerceItemMarker has a selectedQuantity of 1.