APIs for Coupons
Using the Salesforce B2C Commerce API, you can add multiple coupon codes for the same coupon to a basket.
The behavior controlled by this setting is enforced regardless of how the coupon is added
to basket: B2C Commerce Script API, SHOP API, AddCouponToBasket
or
AddCouponToBasket2
pipelets.
Each unique code added to a basket results in a unique
CouponLineItem
being added. Conversely, every
CouponLineItem
represents a single coupon code.
When an order is created (that is, the basket is turned into an order),
all coupon codes associated with the order are marked as
redeemed
.
The logic for retrieving active customer promotions is the same as for
other promotions. For example,
PromotionMgr.getActiveCustomerPromotions()
returns the
same information whether a promotion is triggered in the cart by one
coupon code or multiple.
When using this coupon type with a
Choice
of Bonus Product
discount, the
BonusDiscountLineItem
created by B2C Commerce is
associated with the triggering coupon code. The triggering coupon code is
determined by the position of the coupon code and the bonus discount line
item within the basket. You can access this association via the B2C Commerce Script API, so that the storefront application can show that the bonus products
relate to a specific coupon code. If a coupon code is removed from the
cart, only the related bonus products are also removed from the cart.