Class Discount
Superclass of all specific discount classes.
AmountDiscount, BonusChoiceDiscount, BonusDiscount, FixedPriceDiscount, FixedPriceShippingDiscount, FreeDiscount, FreeShippingDiscount, PercentageDiscount, PercentageOptionDiscount, PriceBookPriceDiscount, TotalFixedPriceDiscount
| Constant | Description |
|---|---|
| TYPE_AMOUNT: String = "AMOUNT" | Constant representing discounts of type amount. |
| TYPE_BONUS: String = "BONUS" | Constant representing discounts of type bonus. |
| TYPE_BONUS_CHOICE: String = "BONUS_CHOICE" | Constant representing discounts of type bonus choice. |
| TYPE_FIXED_PRICE: String = "FIXED_PRICE" | Constant representing discounts of type fixed-price. |
| TYPE_FIXED_PRICE_SHIPPING: String = "FIXED_PRICE_SHIPPING" | Constant representing discounts of type fixed price shipping. |
| TYPE_FREE: String = "FREE" | Constant representing discounts of type free. |
| TYPE_FREE_SHIPPING: String = "FREE_SHIPPING" | Constant representing discounts of type free shipping. |
| TYPE_PERCENTAGE: String = "PERCENTAGE" | Constant representing discounts of type percentage. |
| TYPE_PERCENTAGE_OFF_OPTIONS: String = "PERCENTAGE_OFF_OPTIONS" | Constant representing discounts of type percent off options. |
| TYPE_PRICEBOOK_PRICE: String = "PRICE_BOOK_PRICE" | Constant representing discounts of type price book price. |
| TYPE_TOTAL_FIXED_PRICE: String = "TOTAL_FIXED_PRICE" | Constant representing discounts of type total fixed price. |
| Property | Description |
|---|---|
itemPromotionTiers: Map (read-only) | Returns the tier index by quantity Id of Product promotion. |
promotion: Promotion (read-only) | Returns the promotion this discount is based on. |
promotionTier: Number (read-only) | Returns the tier index for promotion at order level or bonus product. |
quantity: Number (read-only) | Returns the quantity of the discount. |
type: String (read-only) | Returns the type of the discount. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| getItemPromotionTiers() | Returns the tier index by quantity Id of Product promotion. |
| getPromotion() | Returns the promotion this discount is based on. |
| getPromotionTier() | Returns the tier index for promotion at order level or bonus product. |
| getQuantity() | Returns the quantity of the discount. |
| getType() | Returns the type of the discount. |
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
- TYPE_AMOUNT: String = "AMOUNT"
Constant representing discounts of type amount.
- TYPE_BONUS: String = "BONUS"
Constant representing discounts of type bonus.
- TYPE_BONUS_CHOICE: String = "BONUS_CHOICE"
Constant representing discounts of type bonus choice.
- TYPE_FIXED_PRICE: String = "FIXED_PRICE"
Constant representing discounts of type fixed-price.
- TYPE_FIXED_PRICE_SHIPPING: String = "FIXED_PRICE_SHIPPING"
Constant representing discounts of type fixed price shipping.
- TYPE_FREE: String = "FREE"
Constant representing discounts of type free.
- TYPE_FREE_SHIPPING: String = "FREE_SHIPPING"
Constant representing discounts of type free shipping.
- TYPE_PERCENTAGE: String = "PERCENTAGE"
Constant representing discounts of type percentage.
- TYPE_PERCENTAGE_OFF_OPTIONS: String = "PERCENTAGE_OFF_OPTIONS"
Constant representing discounts of type percent off options.
- TYPE_PRICEBOOK_PRICE: String = "PRICE_BOOK_PRICE"
Constant representing discounts of type price book price.
- TYPE_TOTAL_FIXED_PRICE: String = "TOTAL_FIXED_PRICE"
Constant representing discounts of type total fixed price.
- itemPromotionTiers: Map
(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() method.
See Also:
- promotion: Promotion
(read-only) Returns the promotion this discount is based on.
- promotionTier: Number
(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: Number
(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: String
(read-only) Returns the type of the discount.
- getItemPromotionTiers(): Map
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() method.
Returns:
- Map of Tier index by quantity Id or
empty map
See Also:
- Map of Tier index by quantity Id or
- getPromotion(): Promotion
Returns the promotion this discount is based on.
Returns:
- Promotion related to this discount
- getPromotionTier(): Number
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
- Tier index or
- getQuantity(): Number
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(): String
Returns the type of the discount.
Returns:
- Discount type