Class CouponLineItem

The CouponLineItem class is used to store redeemed coupons in the Basket.

PropertyDescription
applied: Boolean (read-only)Identifies if the coupon is currently applied in the basket.
basedOnCampaign: Boolean (read-only)Returns true if the line item represents a coupon of a campaign.
bonusDiscountLineItems: Collection (read-only)Returns the bonus discount line items of the line item container triggered by this coupon.
couponCode: String (read-only)Returns the coupon code.
priceAdjustments: Collection (read-only)Returns the price adjustments of the line item container triggered by this coupon.
promotion: Promotion (read-only)Returns the promotion related to the coupon line item.
promotionID: String (read-only)Returns the id of the related promotion.
statusCode: String (read-only)This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid.
valid: Boolean (read-only)Allows to check whether the coupon code of this coupon line item instance is valid.

This class does not have a constructor, so you cannot create it directly.

MethodDescription
associatePriceAdjustment(PriceAdjustment)Associates the specified price adjustment with the coupon line item.
getBonusDiscountLineItems()Returns the bonus discount line items of the line item container triggered by this coupon.
getCouponCode()Returns the coupon code.
getPriceAdjustments()Returns the price adjustments of the line item container triggered by this coupon.
getPromotion()Returns the promotion related to the coupon line item.
getPromotionID()Returns the id of the related promotion.
getStatusCode()This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid.
isApplied()Identifies if the coupon is currently applied in the basket.
isBasedOnCampaign()Returns true if the line item represents a coupon of a campaign.
isValid()Allows to check whether the coupon code of this coupon line item instance is valid.

describe, getCustom

getCreationDate, getLastModified, getUUID

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

applied: Boolean (read-only)

Identifies if the coupon is currently applied in the basket. A coupon line is applied if there exists at least one price adjustment related to the coupon line item.


basedOnCampaign: Boolean (read-only)

Returns true if the line item represents a coupon of a campaign. If the coupon line item represents a custom coupon code, the method returns false.


bonusDiscountLineItems: Collection (read-only)

Returns the bonus discount line items of the line item container triggered by this coupon.


couponCode: String (read-only)

Returns the coupon code.


priceAdjustments: Collection (read-only)

Returns the price adjustments of the line item container triggered by this coupon.


promotion: Promotion (read-only)

Returns the promotion related to the coupon line item.

Deprecated:

A coupon code and its coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns one of the promotions associated with the coupon code.


promotionID: String (read-only)

Returns the id of the related promotion.

Deprecated:

A coupon code and it's coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns the ID of one of the promotions associated with the coupon code.


statusCode: String (read-only)

This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid.


valid: Boolean (read-only)

Allows to check whether the coupon code of this coupon line item instance is valid. Coupon line item is valid, if status code is one of the following:


associatePriceAdjustment(priceAdjustment: PriceAdjustment): void

Associates the specified price adjustment with the coupon line item. This method is only applicable if used for price adjustments and coupon line items NOT based on B2C Commerce campaigns.

Parameters:

  • priceAdjustment - Price adjustment to be associated with coupon line item.

getBonusDiscountLineItems(): Collection

Returns the bonus discount line items of the line item container triggered by this coupon.

Returns:

  • Price adjustments triggered by the coupon

getCouponCode(): String

Returns the coupon code.

Returns:

  • Coupon code

getPriceAdjustments(): Collection

Returns the price adjustments of the line item container triggered by this coupon.

Returns:

  • Price adjustments triggered by the coupon

getPromotion(): Promotion

Returns the promotion related to the coupon line item.

Returns:

  • Promotion related to coupon represented by line item

Deprecated:

A coupon code and its coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns one of the promotions associated with the coupon code.


getPromotionID(): String

Returns the id of the related promotion.

Returns:

  • the id of the related promotion.

Deprecated:

A coupon code and it's coupon can be associated with multiple promotions. Therefore, this method is not appropriate anymore. For backward-compatibility, the method returns the ID of one of the promotions associated with the coupon code.


getStatusCode(): String

This method provides a detailed error status in case the coupon code of this coupon line item instance became invalid.

Returns:

  • Returns APPLIED if coupon is applied, and otherwise one of the codes defined in CouponStatusCodes

isApplied(): Boolean

Identifies if the coupon is currently applied in the basket. A coupon line is applied if there exists at least one price adjustment related to the coupon line item.

Returns:

  • true if the coupon is currently applied in the basket.

isBasedOnCampaign(): Boolean

Returns true if the line item represents a coupon of a campaign. If the coupon line item represents a custom coupon code, the method returns false.


isValid(): Boolean

Allows to check whether the coupon code of this coupon line item instance is valid. Coupon line item is valid, if status code is one of the following:

Returns:

  • true if the coupon code is valid, false otherwise.