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

PropertyReturnsDescription
activatedPromosSet<Reward>Rewards that have already been activated as promotions for this checkout, for example by an entry code.
availablePromosList<Reward>Rewards available to be applied as promotions during this checkout.
checkoutItemsList<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.
mainItemsList<CheckoutLineItem>The line items the customer explicitly added to their cart, not including any items added by checkout rules.
promoActivatedbooleanWhether 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

PropertyReturnsDescription
cartCartThe cart the checkout is being computed for.
purchaserProfileThe profile making the purchase.
ruleCustomCheckoutRuleThe checkout rule that this context is being evaluated for.
storeECommerceStoreThe 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.

ParameterDescription
lithe 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.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.