Salesforce B2C Commerce 23.5 > B2C Commerce API > B2C Commerce Pipelets > Basket
Pipelet AddCouponToBasket2
Validates the supplied coupon code and, if the coupon code is valid, applies them to the basket.
While applying the coupon code the pipelet adds a new CouponLineItem to the basket based on the supplied coupon code. The coupon code gets set at the CouponLineItem.
A coupon code can be invalid because of the following reasons:

In this case, no CouponLineItem is added to the basket and the pipelet returns to the error connector. The returned "Status" object contains the details of why the coupon was invalid. Status: The status object representing a detailed result of the operation. The status property (Status.status) will be set to 0 if the coupon was successfully applied or 1 otherwise. The code property (Status.code) will be set to one of the following values:
Group:
Basket
Flags:
Error Connector
Transaction Required
Input Parameters
Basket  :  LineItemCtnr (Required)
The basket to add the coupon to.
CouponCode  :  String (Required)
The code of the coupon to add.
Output Parameters
Status  :  Status  :  (Required)
The status object representing a detailed result of the operation. The status property (Status.status) will be set to 0 if the coupon was successfully applied or 1 otherwise. The code property (Status.code) will be set to one of the following values:
  • "OK" = The coupon was applied to the basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_IN_BASKET = Indicates that coupon code has already been added to basket.
  • CouponStatusCodes.COUPON_ALREADY_IN_BASKET = Indicates that another code of the same MultiCode/System coupon has already been added to basket.
  • CouponStatusCodes.COUPON_CODE_ALREADY_REDEEMED = Indicates that code of MultiCode/System coupon has already been redeemed.
  • CouponStatusCodes.COUPON_CODE_UNKNOWN = Indicates that coupon not found for given coupon code or that the code itself was not found.
  • CouponStatusCodes.COUPON_DISABLED = Indicates that coupon is not enabled.
  • CouponStatusCodes.COUPON_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code exceeded.
  • CouponStatusCodes.REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code and customer exceeded.
  • CouponStatusCodes.TIMEFRAME_REDEMPTION_LIMIT_EXCEEDED = Indicates that number of redemptions per code, customer and time exceeded.
  • CouponStatusCodes.NO_ACTIVE_PROMOTION = Indicates that coupon is not assigned to an active promotion.
CouponLineItem  :  CouponLineItem  :  (Optional)
The newly created coupon line item.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.