This article provides the required steps to apply overrides to accomplish two promotion-related scenarios:
Retrieve the promotions that are applied to a given line item in the order.
Provide information about which promotions were applied to the order AND also report which promotions were order level vs. order line level.
The following table shows the default behavior of the APIs related to promotions:
Column Title | Column Title | Column Title |
GET | /api/v1/carts/{cartId}/promotions | Return a collection of promotions applied to a specific shopping cart |
POST | /api/v1/carts/{cartId}/promotions | Apply promotions to a specific shopping cart |
GET | /api/v1/carts/{cartId}/promotions/{promotionId} | Return a single promotion for a specific shopping cart |
Retrieving the Cart Line Level Data
Create a custom mapper class that inherits from the **GetCartLineMapper** base class.
Override the **MapResult** method. Be sure to call the base method before doing any work.
The **GetCartLineResult** object is passed into the **MapResult** method. This object contains the **CartLine** object as a property, which contains a **PromotionResult** property and a **Promotion** property. Add any additional information you need to the **Properties** collection of the **GetCartLineModel** object.
The following mapper adds the Promotion "Name" to the **Properties** collection.