Line item representing an applied
BonusChoiceDiscount in a LineItemCtnr. This type of line item
can only be created by the B2C Commerce promotions engine when applying a BonusChoiceDiscount.
A BonusDiscountLineItem is basically a placeholder in the cart which entitles a customer to add one or more bonus
products to his basket from a configured list of products. Merchants typically display this type of line item in the
cart by showing the corresponding promotion callout message. They typically provide links to the bonus products that
the customer can choose from. This line item can be removed from the cart but will be re-added each time the
promotions engine re-applies discounts. Merchants may however add custom logic to show/hide this line item since it
just a placeholder and not an actual product line item.
The number of products that a customer is allowed to choose from is determined by
getMaxBonusItems(). The
collection of products the customer can choose from is determined by
getBonusProducts(). When a customer
chooses a bonus product in the storefront, it is necessary to use the
AddBonusProductToBasket
pipelet
instead of the usual
AddProductToBasket
pipelet, in order to associate this BonusDiscountLineItem with
the newly created bonus ProductLineItem. Alternatively, the API method
LineItemCtnr.createBonusProductLineItem(BonusDiscountLineItem, Product, ProductOptionModel, Shipment)
can be used instead. The system does proper validations in order to prevent incorrect or too many bonus products from
being associated with this BonusDiscountLineItem. Once a customer has selected bonus products, the product line items
representing the chosen bonus products can be retrieved with
getBonusProductLineItems().