# Class CouponLineItem

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.object.PersistentObject](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md)
    - [dw.object.ExtensibleObject](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md)
      - [dw.order.CouponLineItem](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md)

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

## Property Summary

| Property                                                                                                                                                   | Description                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [applied](#applied): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`                                    | Identifies if the coupon is currently applied in the basket.                                                            |
| [basedOnCampaign](#basedoncampaign): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`                    | Returns true if the line item represents a coupon of a campaign.                                                        |
| [bonusDiscountLineItems](#bonusdiscountlineitems): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)` | Returns the bonus discount line items of the line item container triggered  by this coupon.                             |
| [couponCode](#couponcode): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`                                | Returns the coupon code.                                                                                                |
| [priceAdjustments](#priceadjustments): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`             | Returns the price adjustments of the line item container triggered  by this coupon.                                     |
| ~~[promotion](#promotion): [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md)~~ `(read-only)`                     | Returns the promotion related to the coupon line item.                                                                  |
| ~~[promotionID](#promotionid): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)`                          | Returns the id of the related promotion.                                                                                |
| [statusCode](#statuscode): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`                                | This method provides a detailed error status in case the coupon code of  this coupon line item instance became invalid. |
| [valid](#valid): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(read-only)`                                        | Allows to check whether the coupon code of this coupon line item instance  is valid.                                    |

## Constructor Summary

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

## Method Summary

| Method                                                                                                                                                                                                                                                     | Description                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| [associatePriceAdjustment](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#associatepriceadjustmentpriceadjustment)([PriceAdjustment](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PriceAdjustment.md)) | Associates the specified price adjustment with the coupon line item.                                                    |
| [getBonusDiscountLineItems](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getbonusdiscountlineitems)()                                                                                                                  | Returns the bonus discount line items of the line item container triggered  by this coupon.                             |
| [getCouponCode](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getcouponcode)()                                                                                                                                          | Returns the coupon code.                                                                                                |
| [getPriceAdjustments](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getpriceadjustments)()                                                                                                                              | Returns the price adjustments of the line item container triggered  by this coupon.                                     |
| ~~[getPromotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getpromotion)()~~                                                                                                                                        | Returns the promotion related to the coupon line item.                                                                  |
| ~~[getPromotionID](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getpromotionid)()~~                                                                                                                                    | Returns the id of the related promotion.                                                                                |
| [getStatusCode](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#getstatuscode)()                                                                                                                                          | This method provides a detailed error status in case the coupon code of  this coupon line item instance became invalid. |
| [isApplied](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#isapplied)()                                                                                                                                                  | Identifies if the coupon is currently applied in the basket.                                                            |
| [isBasedOnCampaign](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#isbasedoncampaign)()                                                                                                                                  | Returns true if the line item represents a coupon of a campaign.                                                        |
| [isValid](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.CouponLineItem.md#isvalid)()                                                                                                                                                      | Allows to check whether the coupon code of this coupon line item instance  is valid.                                    |

### Methods inherited from class ExtensibleObject

[describe](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#describe), [getCustom](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.ExtensibleObject.md#getcustom)

### Methods inherited from class PersistentObject

[getCreationDate](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getcreationdate), [getLastModified](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getlastmodified), [getUUID](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.object.PersistentObject.md#getuuid)

### Methods inherited from class Object

[assign](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)

## Property Details

### applied

- applied: [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(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

- basedOnCampaign: [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(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

- bonusDiscountLineItems: [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
  - : Returns the bonus discount line items of the line item container triggered
    by this coupon.

***

### couponCode

- couponCode: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
  - : Returns the coupon code.

***

### priceAdjustments

- priceAdjustments: [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md) `(read-only)`
  - : Returns the price adjustments of the line item container triggered
    by this coupon.

***

### promotion

- ~~promotion: [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md)~~ `(read-only)`
  - : Returns the promotion related to the coupon line item.

    **Deprecated:**

:::warning
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

- ~~promotionID: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~ `(read-only)`
  - : Returns the id of the related promotion.

    **Deprecated:**

:::warning
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

- statusCode: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
  - : This method provides a detailed error status in case the coupon code of
    this coupon line item instance became invalid.

***

### valid

- valid: [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md) `(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:

    - [CouponStatusCodes.APPLIED](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.CouponStatusCodes.md#applied)
    - [CouponStatusCodes.NO_APPLICABLE_PROMOTION](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.CouponStatusCodes.md#no_applicable_promotion)

***

## Method Details

### associatePriceAdjustment(PriceAdjustment)

- associatePriceAdjustment(priceAdjustment: [PriceAdjustment](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.order.PriceAdjustment.md)): 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()

- getBonusDiscountLineItems(): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
  - : Returns the bonus discount line items of the line item container triggered
    by this coupon.

    **Returns:**

    - Price adjustments triggered by the coupon

***

### getCouponCode()

- getCouponCode(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the coupon code.

    **Returns:**

    - Coupon code

***

### getPriceAdjustments()

- getPriceAdjustments(): [Collection](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Collection.md)
  - : Returns the price adjustments of the line item container triggered
    by this coupon.

    **Returns:**

    - Price adjustments triggered by the coupon

***

### getPromotion()

- ~~getPromotion(): [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md)~~
  - : Returns the promotion related to the coupon line item.

    **Returns:**

    - Promotion related to coupon represented by line item

    **Deprecated:**

:::warning
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()

- ~~getPromotionID(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)~~
  - : Returns the id of the related promotion.

    **Returns:**

    - the id of the related promotion.

    **Deprecated:**

:::warning
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()

- getStatusCode(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : 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](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.CouponStatusCodes.md)

***

### isApplied()

- isApplied(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : 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()

- isBasedOnCampaign(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : 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()

- isValid(): [Boolean](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Boolean.md)
  - : 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:

    - [CouponStatusCodes.APPLIED](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.CouponStatusCodes.md#applied)
    - [CouponStatusCodes.NO_APPLICABLE_PROMOTION](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.CouponStatusCodes.md#no_applicable_promotion)

    **Returns:**

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

***
