# Class Discount

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.campaign.Discount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md)

Superclass of all specific discount classes.

## All Known Subclasses

[AmountDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.AmountDiscount.md), [BonusChoiceDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.BonusChoiceDiscount.md), [BonusDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.BonusDiscount.md), [FixedPriceDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.FixedPriceDiscount.md), [FixedPriceShippingDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.FixedPriceShippingDiscount.md), [FreeDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.FreeDiscount.md), [FreeShippingDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.FreeShippingDiscount.md), [PercentageDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.PercentageDiscount.md), [PercentageOptionDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.PercentageOptionDiscount.md), [PriceBookPriceDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.PriceBookPriceDiscount.md), [TotalFixedPriceDiscount](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.TotalFixedPriceDiscount.md)

## Constant Summary

| Constant                                                                                                                                                                   | Description                                                     |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [TYPE_AMOUNT](#type_amount): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "AMOUNT"                                                 | Constant representing discounts of type *amount*.               |
| [TYPE_BONUS](#type_bonus): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "BONUS"                                                    | Constant representing discounts of type *bonus*.                |
| [TYPE_BONUS_CHOICE](#type_bonus_choice): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "BONUS_CHOICE"                               | Constant representing discounts of type *bonus choice*.         |
| [TYPE_FIXED_PRICE](#type_fixed_price): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FIXED_PRICE"                                  | Constant representing discounts of type *fixed-price*.          |
| [TYPE_FIXED_PRICE_SHIPPING](#type_fixed_price_shipping): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FIXED_PRICE_SHIPPING"       | Constant representing discounts of type *fixed price shipping*. |
| [TYPE_FREE](#type_free): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FREE"                                                       | Constant representing discounts of type *free*.                 |
| [TYPE_FREE_SHIPPING](#type_free_shipping): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FREE_SHIPPING"                            | Constant representing discounts of type *free shipping*.        |
| [TYPE_PERCENTAGE](#type_percentage): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PERCENTAGE"                                     | Constant representing discounts of type *percentage*.           |
| [TYPE_PERCENTAGE_OFF_OPTIONS](#type_percentage_off_options): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PERCENTAGE_OFF_OPTIONS" | Constant representing discounts of type *percent off options*.  |
| [TYPE_PRICEBOOK_PRICE](#type_pricebook_price): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PRICE_BOOK_PRICE"                     | Constant representing discounts of type *price book price*.     |
| [TYPE_TOTAL_FIXED_PRICE](#type_total_fixed_price): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "TOTAL_FIXED_PRICE"                | Constant representing discounts of type *total fixed price*.    |

## Property Summary

| Property                                                                                                                             | Description                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| [itemPromotionTiers](#itempromotiontiers): [Map](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)` | Returns the tier index by quantity Id of Product promotion.           |
| [promotion](#promotion): [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md) `(read-only)`   | Returns the promotion this discount is based on.                      |
| [promotionTier](#promotiontier): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`    | Returns the tier index for promotion at order level or bonus product. |
| [quantity](#quantity): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`              | Returns the quantity of the discount.                                 |
| [type](#type): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`                      | Returns the type of the discount.                                     |

## Constructor Summary

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

## Method Summary

| Method                                                                                                                         | Description                                                           |
| ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| [getItemPromotionTiers](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getitempromotiontiers)() | Returns the tier index by quantity Id of Product promotion.           |
| [getPromotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotion)()                   | Returns the promotion this discount is based on.                      |
| [getPromotionTier](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier)()           | Returns the tier index for promotion at order level or bonus product. |
| [getQuantity](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getquantity)()                     | Returns the quantity of the discount.                                 |
| [getType](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#gettype)()                             | Returns the type of the discount.                                     |

### 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)

## Constant Details

### TYPE_AMOUNT

- TYPE_AMOUNT: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "AMOUNT"
  - : Constant representing discounts of type *amount*.

***

### TYPE_BONUS

- TYPE_BONUS: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "BONUS"
  - : Constant representing discounts of type *bonus*.

***

### TYPE_BONUS_CHOICE

- TYPE_BONUS_CHOICE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "BONUS_CHOICE"
  - : Constant representing discounts of type *bonus choice*.

***

### TYPE_FIXED_PRICE

- TYPE_FIXED_PRICE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FIXED_PRICE"
  - : Constant representing discounts of type *fixed-price*.

***

### TYPE_FIXED_PRICE_SHIPPING

- TYPE_FIXED_PRICE_SHIPPING: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FIXED_PRICE_SHIPPING"
  - : Constant representing discounts of type *fixed price shipping*.

***

### TYPE_FREE

- TYPE_FREE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FREE"
  - : Constant representing discounts of type *free*.

***

### TYPE_FREE_SHIPPING

- TYPE_FREE_SHIPPING: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "FREE_SHIPPING"
  - : Constant representing discounts of type *free shipping*.

***

### TYPE_PERCENTAGE

- TYPE_PERCENTAGE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PERCENTAGE"
  - : Constant representing discounts of type *percentage*.

***

### TYPE_PERCENTAGE_OFF_OPTIONS

- TYPE_PERCENTAGE_OFF_OPTIONS: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PERCENTAGE_OFF_OPTIONS"
  - : Constant representing discounts of type *percent off options*.

***

### TYPE_PRICEBOOK_PRICE

- TYPE_PRICEBOOK_PRICE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PRICE_BOOK_PRICE"
  - : Constant representing discounts of type *price book price*.

***

### TYPE_TOTAL_FIXED_PRICE

- TYPE_TOTAL_FIXED_PRICE: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "TOTAL_FIXED_PRICE"
  - : Constant representing discounts of type *total fixed price*.

***

## Property Details

### itemPromotionTiers

- itemPromotionTiers: [Map](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md) `(read-only)`
  - : Returns the tier index by quantity Id of Product promotion. ProductLineItems may have more than one quantity, but
    not all items of that SKU may have received the same tier of promotion. Each quantity of the ProductLineItem is
    indexed from 1 to n, where n is the quantity of the ProductLineItem, and this method returns a mapping from that
    quantity index to the index of tier of the promotion that item received. For more information about tier indexes,
    see [getPromotionTier()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier)  method.

    **See Also:**

    - [getPromotionTier()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier)

***

### promotion

- promotion: [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md) `(read-only)`
  - : Returns the promotion this discount is based on.

***

### promotionTier

- promotionTier: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
  - : Returns the tier index for promotion at order level or bonus product.
    Promotion tiers are always evaluated in the order of the highest threshold (e.g. quantity, or amount)
    to the lowest threshold. The tier that is evaluated first (i.e. the highest quantity or amount) is indexed as 0,
    the next tier 1, etc. The lowest tier will have index n - 1, where n is the total number of tiers.

***

### quantity

- quantity: [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md) `(read-only)`
  - : Returns the quantity of the discount. This quantity specifies how often
    this discount applies to its target object. For example, a 10% off
    discount with quantity 2 associated to a product line item with
    quantity 3 is applied to two items of the product line item.

    Discounts of order and shipping promotions, and bonus discounts
    have a fix quantity of 1.

***

### type

- type: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) `(read-only)`
  - : Returns the type of the discount.

***

## Method Details

### getItemPromotionTiers()

- getItemPromotionTiers(): [Map](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.util.Map.md)
  - : Returns the tier index by quantity Id of Product promotion. ProductLineItems may have more than one quantity, but
    not all items of that SKU may have received the same tier of promotion. Each quantity of the ProductLineItem is
    indexed from 1 to n, where n is the quantity of the ProductLineItem, and this method returns a mapping from that
    quantity index to the index of tier of the promotion that item received. For more information about tier indexes,
    see [getPromotionTier()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier)  method.

    **Returns:**

    - Map of Tier index by quantity Id or `empty map`

    **See Also:**

    - [getPromotionTier()](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Discount.md#getpromotiontier)

***

### getPromotion()

- getPromotion(): [Promotion](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.campaign.Promotion.md)
  - : Returns the promotion this discount is based on.

    **Returns:**

    - Promotion related to this discount

***

### getPromotionTier()

- getPromotionTier(): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the tier index for promotion at order level or bonus product.
    Promotion tiers are always evaluated in the order of the highest threshold (e.g. quantity, or amount)
    to the lowest threshold. The tier that is evaluated first (i.e. the highest quantity or amount) is indexed as 0,
    the next tier 1, etc. The lowest tier will have index n - 1, where n is the total number of tiers.

    **Returns:**

    - Tier index or `null`

***

### getQuantity()

- getQuantity(): [Number](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Number.md)
  - : Returns the quantity of the discount. This quantity specifies how often
    this discount applies to its target object. For example, a 10% off
    discount with quantity 2 associated to a product line item with
    quantity 3 is applied to two items of the product line item.

    Discounts of order and shipping promotions, and bonus discounts
    have a fix quantity of 1.

    **Returns:**

    - Discount quantity

***

### getType()

- getType(): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)
  - : Returns the type of the discount.

    **Returns:**

    - Discount type

***
