dw.campaign
Class BonusChoiceDiscount
Object
dw.campaign.Discount
dw.campaign.BonusChoiceDiscount
Represents a choice of bonus products discount in the discount plan, for example "Choose 3 DVDs from a list of 20 options with your purchase of any DVD player."
Properties
bonusProducts  :  List  (Read Only)
Get the list of bonus products which the customer is allowed to choose from for this discount. This list is configured by a merchant entering a list of SKUs for the discount. Products which do not exist in the system, or are offline, or are not assigned to a category in the site catalog are filtered out. Unavailable (i.e. out-of-stock) products are NOT filtered out. This allows merchants to display out-of-stock bonus products with appropriate messaging.

If a returned product is a master product, the customer is entitled to choose from any variant. If the product is an option product, the customer is entitled to choose any value for each option. Since the promotions engine does not touch the value of the product option line items, it is the responsibility of custom code to set option prices.

If the promotion is rule based, then this method will return an empty list. A ProductSearchModel should be used to return the bonus products the customer may choose from instead. See ProductSearchModel.PROMOTION_PRODUCT_TYPE_BONUS and ProductSearchModel.setPromotionID(String)

maxBonusItems  :  Number  (Read Only)
The maximum number of bonus items that a customer is entitled to select for this discount.
ruleBased  :  boolean  (Read Only)
Returns true if this is a "rule based" bonus choice discount. For such discounts, there is no static list of bonus products associated with the discount but rather a discounted product rule associated with the promotion which defines the bonus products. To retrieve the list of selectable bonus products for display in the storefront, it is necessary to search for the bonus products using the ProductSearchModel API since the method getBonusProducts() in this class will always return an empty list. Furthermore, for rule based bonus-choice discounts, getBonusProductPrice(Product) will always return a price of 0.00 for bonus products.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getBonusProductPrice(product : Product) : Number
Get the effective price for the passed bonus product.
getBonusProducts() : List
Get the list of bonus products which the customer is allowed to choose from for this discount.
getMaxBonusItems() : Number
Returns the maximum number of bonus items that a customer is entitled to select for this discount.
isRuleBased() : boolean
Returns true if this is a "rule based" bonus choice discount.
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Method Detail
getBonusProductPrice
getBonusProductPrice(product : Product) : Number
Get the effective price for the passed bonus product. This is expected to be one of the products returned by getBonusProducts() with one exception: If a master product is configured as a bonus product, this implies that a customer may choose from any of its variants. In this case, it is allowed to pass in a variant to this method and a price will be returned. If the passed product is not a valid bonus product, this method throws an exception.
Parameters:
product - The bonus product to retrieve a price for, must not be null.
Returns:
The price of the passed bonus product as a Number.

getBonusProducts
getBonusProducts() : List
Get the list of bonus products which the customer is allowed to choose from for this discount. This list is configured by a merchant entering a list of SKUs for the discount. Products which do not exist in the system, or are offline, or are not assigned to a category in the site catalog are filtered out. Unavailable (i.e. out-of-stock) products are NOT filtered out. This allows merchants to display out-of-stock bonus products with appropriate messaging.

If a returned product is a master product, the customer is entitled to choose from any variant. If the product is an option product, the customer is entitled to choose any value for each option. Since the promotions engine does not touch the value of the product option line items, it is the responsibility of custom code to set option prices.

If the promotion is rule based, then this method will return an empty list. A ProductSearchModel should be used to return the bonus products the customer may choose from instead. See ProductSearchModel.PROMOTION_PRODUCT_TYPE_BONUS and ProductSearchModel.setPromotionID(String)

Returns:
An ordered list of bonus products that the customer may choose from for this discount.

getMaxBonusItems
getMaxBonusItems() : Number
Returns the maximum number of bonus items that a customer is entitled to select for this discount.
Returns:
The maximum number of bonus items that this discount permits a customer to select.

isRuleBased
isRuleBased() : boolean
Returns true if this is a "rule based" bonus choice discount. For such discounts, there is no static list of bonus products associated with the discount but rather a discounted product rule associated with the promotion which defines the bonus products. To retrieve the list of selectable bonus products for display in the storefront, it is necessary to search for the bonus products using the ProductSearchModel API since the method getBonusProducts() in this class will always return an empty list. Furthermore, for rule based bonus-choice discounts, getBonusProductPrice(Product) will always return a price of 0.00 for bonus products.
Returns:
True if this is a rule-based bonus-choice discount, or false if this discount defines a simple static list of bonus products.

β™₯
Notifications pending to read