---
schema_version: "1"
id: 294205371ab24374931c69fd68fd9d236ce5e998c24e46de43afb7fab2fbd7e1
title: Choice-of-Bonus-Product Discount FAQ in B2C Commerce
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_choice_of_bonus_product_discount_faq.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_choice_of_bonus_product_discount_faq.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: f2e6f560d3f5f9f91746f31bc885d6c9606be85c5da0bc352bd0af55136df335
description: The APIs described in the topic, Implementing a Choice-of-Bonus-Product Discount, are all that you need to implement this discount in your storefront. Use the following to address some common questions.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Choice-of-Bonus-Product Discount FAQ in B2C Commerce

The APIs described in the topic, Implementing a Choice-of-Bonus-Product Discount, are all that you need to implement this discount in your storefront. Use the following to address some common questions.

Q: What if the shopper or basket no longer qualifies for a choice-of-bonus-product discount?

A: If the shopper no longer qualifies for the discount when Salesforce B2C Commerce applies discounts, it removes the `BonusDiscountLineItem` and associated selected products. This is similar to how other bonus products are handled and promotions in general.

Q: What if there aren't enough bonus items available? Or what if the bonus products become unavailable while already in the basket or during checkout?

A: When checking out, the application pipeline or script logic validates that there’s enough available-to-sell of each item in the basket to place the order. SiteGenesis shows unavailable products on the bonus selection page but prevents their selection. These products aren't filtered out by `BonusDiscountLineItem.getBonusProducts()).` SiteGenesis also shows a message to the shopper on the bonus select page and cart page if a previously selected bonus product has become unavailable. The shopper can’t check out until they remove the product. If all bonus products become unavailable during checkout, the promotion doesn't apply in the shopper's cart. See the answer to the previous question.

Q: What if the number of bonus items in the basket exceeds the configured maximum number of bonus items?

A: Code your application pipeline or script logic to prevent this. The API itself doesn't actually enforce that the number of bonus items selected doesn't exceed the number allowed by the discount. For example, custom code can simply call setQuantity() on a bonus ProductLineItem and increase the number of selected items beyond the maximum. If you configure your logic properly, this situation can only occur when the merchant decreases the quantity after a shopper receives the bonus discount. In SiteGenesis, the `ValidateCartForCheckout.ds` script checks for this case and prevents the shopper from placing the order if it happens.

Q: What if a bonus product is no longer assigned to a bonus discount, is offline, not assigned to site, or deleted?

A: B2C Commerce excludes these products from the list returned by `BonusDiscountLineItem.getBonusProducts()`; they don't appear on a bonus selection page.

Q: What if a bonus product in the basket is no longer assigned to a bonus discount, is offline, not assigned to site, or deleted?

A: This scenario can only occur if the merchant changes the bonus promotion or products assigned to the bonus promotion after the bonus promotion has been applied. When B2C Commerce applies discounts and a cart with an associated `ProductLineitem` has a product that is no longer available, B2C Commerce automatically removes the product.

Q: What if the shopper doesn't select any bonus products or selects fewer bonus items than allowed?

A: You can't force a shopper to accept free items. The storefront provides messages to the shopper on the cart page, but doesn't prevent checkout. The order ends up containing a `BonusDiscountLineItem` with no selected products.

Q: What if I want to show the bonus product's original price in the cart to indicate the savings to the shopper?

A: B2C Commerce sets the price of bonus product line items to $0.00 in the cart. The SiteGenesis script `CalculateCart.ds` adjusts the price of each bonus `ProductLineItem` to its price-book price. Then the script adjusts the price of its bonus `PriceAdjustment` to indicate the savings. The logic is as follows:

```
if(productLineItem.bonusProductLineItem && product != null)
{ 
	var price : Money = product.priceModel.price;
	productLineItem.setPriceValue(price.valueOrNull);
	var quantity : Quantity = productLineItem.quantity;

	// we assume that a bonus line item has only one price adjustment
	var adjustments : Collection = productLineItem.priceAdjustments;

	if(!adjustments.isEmpty())
	{
		var adjustment : PriceAdjustment = adjustments.iterator().next();
		var adjustmentPrice : Money = price.multiply(quantity.value).multiply(-1.0);
		adjustment.setPriceValue(adjustmentPrice.valueOrNull);
	}
}
```

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_note.png)

Note This code is in an `else if` section.

The code works the same for bonus product line items, regardless of whether the triggering discount was a standard bonus discount or the choice-of-bonus-product discount.

Q: How does B2C Commerce handle coupons with this discount?

A: When a promotion is coupon-based, B2C Commerce generates a `PriceAdjustment` and associates it with the triggering `CouponLineItem.` The API provides methods `CouponLineItem.getPriceAdjustments()` and `PriceAdjustment.getCouponLineItem()` to navigate this relationship. A coupon in the cart isn't marked as APPLIED unless it actually results in the generation of a `PriceAdjustment.`

When a choice of bonus product discount is coupon-based, B2C Commerce doesn't associate the `BonusDiscountLineItem` with the `CouponLineItem` that triggered the promotion. For example, there’s no `CouponLineItem.getBonusDiscountLineItems() method`. The coupon remains unapplied until the shopper selects bonus products. When the shopper selects bonus products, B2C Commerce:

1. Generates a `PriceAdjustment` on each bonus product line item.
2. Associates these adjustments with the triggering `CouponLineItem.`
3. Marks the coupon as APPLIED.

Q: How do I modify my application to remove a discount from the cart? What are the ramifications?

A: The API provides a method to remove a BonusDiscountLineItem from the cart. However, even if you write custom code to remove a `BonusDiscountLineItem` from the cart, the next time a discount applies, the bonus discount is re-created. For example, a choice-of-bonus-product discount blocks another promotion from applying due to exclusivity or rank. By design, there’s no way to remove the bonus promotion to let the blocked promotion apply.