Script: Class dw.campaign.ApproachingDiscount

Class ApproachingDiscount

  • Object
    • dw.campaign.ApproachingDiscount

Transient class representing a discount that a LineItemCtnr "almost" qualifies for based on the amount of merchandise in it. Storefronts can display information about approaching discounts to customers in order to entice them to buy more merchandise.

Approaching discounts are calculated on the basis of a DiscountPlan instead of a LineItemCtnr itself. When one of PromotionMgr.getDiscounts(LineItemCtnr) or PromotionMgr.getDiscounts(LineItemCtnr, PromotionPlan) is called, the promotions engine calculates the discounts the LineItemCtnr receives based on the promotions in context, and also tries to determine the discounts the LineItemCtnr would receive if additional merchandise were added. DiscountPlan provides different methods to retrieve this approaching discount info. Merchants can use these fine-grained methods to display information about approaching order discounts on the cart page, and approaching shipping discounts on the shipping method page during checkout, for example.

The merchant may include or exclude individual promotions from being included in this list, and define distance thresholds when configuring their promotions.

Properties

conditionThreshold : Money Read Only

The amount of merchandise required in the cart in order to receive the discount. For an order promotion "Get 15% off orders of $100 or more", the condition threshold is $100.00.

discount : Discount Read Only

The discount that the customer will receive if he adds more merchandise to the cart. For an order promotion "Get 15% off orders of $100 or more", the discount is a PercentageDiscount object.

distanceFromConditionThreshold : Money Read Only

Convenience method that returns getConditionThreshold().subtract(getMerchandiseValue())

merchandiseTotal : Money Read Only

The amount of merchandise in the cart contributing towards the condition threshold. This will always be less than the condition threshold.

Constructor Summary

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

Method Summary

getConditionThreshold() : Money

The amount of merchandise required in the cart in order to receive the discount.

getDiscount() : Discount

The discount that the customer will receive if he adds more merchandise to the cart.

getDistanceFromConditionThreshold() : Money

Convenience method that returns getConditionThreshold().subtract(getMerchandiseValue())

getMerchandiseTotal() : Money

The amount of merchandise in the cart contributing towards the condition threshold.

Methods inherited from class Object

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

Method Detail

getConditionThreshold

getConditionThreshold() : Money

The amount of merchandise required in the cart in order to receive the discount. For an order promotion "Get 15% off orders of $100 or more", the condition threshold is $100.00.

Returns:

The amount of merchandise required in the cart in order to receive the discount.

getDiscount

getDiscount() : Discount

The discount that the customer will receive if he adds more merchandise to the cart. For an order promotion "Get 15% off orders of $100 or more", the discount is a PercentageDiscount object.

Returns:

The discount that the customer will receive if he adds more merchandise to the cart.


getDistanceFromConditionThreshold

getDistanceFromConditionThreshold() : Money

Convenience method that returns getConditionThreshold().subtract(getMerchandiseValue())

Returns:

The amount of money needed to add to the order or shipment in order to receive the discount.


getMerchandiseTotal

getMerchandiseTotal() : Money

The amount of merchandise in the cart contributing towards the condition threshold. This will always be less than the condition threshold.

Returns:

The amount of merchandise in the cart contributing towards the condition threshold.