Context passed to a checkout rule's check-items function, giving it the cart's current line items, available and activated promotions, and a builder for adding new line items.
Group: E-commerce
Extends: AbstractCheckoutRuleContext
Properties
| Property | Returns | Description |
|---|---|---|
| activatedPromos | Set<Reward> | Rewards that have already been activated as promotions for this checkout, for example by an entry code. |
| availablePromos | List<Reward> | Rewards available to be applied as promotions during this checkout. |
| checkoutItems | List<CheckoutLineItem> | The line items as they will be displayed on the checkout page, including both the customer's selections and any items added by checkout rules. |
| mainItems | List<CheckoutLineItem> | The line items the customer explicitly added to their cart, not including any items added by checkout rules. |
| promoActivated | boolean | Whether the rule's required promotion, if it declares one, has been activated for this checkout. Returns true when the rule declares no promotion. |
Inherited from AbstractCheckoutRuleContext
Properties
| Property | Returns | Description |
|---|---|---|
| cart | Cart | The cart the checkout is being computed for. |
| purchaser | Profile | The profile making the purchase. |
| rule | CustomCheckoutRule | The checkout rule that this context is being evaluated for. |
| store | ECommerceStore | The e-commerce store the cart belongs to. |
Methods
getRule()
Returns: CustomCheckoutRule
The checkout rule that this context is being evaluated for.
getCart()
Returns: Cart
The cart the checkout is being computed for.
getPurchaser()
Returns: Profile
The profile making the purchase.
getStore()
Returns: ECommerceStore
The e-commerce store the cart belongs to.
Methods
getMainItems()
Returns: List<CheckoutLineItem>
The line items the customer explicitly added to their cart, not including any items added by checkout rules.
getCheckoutItems()
Returns: List<CheckoutLineItem>
The line items as they will be displayed on the checkout page, including both the customer's selections and any items added by checkout rules.
getAvailablePromos()
Returns: List<Reward>
Rewards available to be applied as promotions during this checkout.
getActivatedPromos()
Returns: Set<Reward>
Rewards that have already been activated as promotions for this checkout, for example by an entry code.
lineItemBuilder()
Returns: CheckoutLineItemBuilder
Creates a builder for a new line item to add to the checkout, pre-populated with this rule.
addLineItem(CustomCheckoutRuleLineItem li)
Returns: void
Adds a line item to the list displayed to the customer on the checkout page.
| Parameter | Description |
|---|---|
li | the line item to add |
isPromoActivated()
Returns: boolean
Whether the rule's required promotion, if it declares one, has been activated for this checkout. Returns true when the rule declares no promotion.