Skip to main content

Promotion Action

An abstract class which is extended by PromotionItemAction, PromotionOrderAction, and PromotionShippingAction.

Signature

priorityValue

propertynumber
Default:0

Used to determine the order of application of multiple Promotions on the same Order. See the Promotion priorityScore field for more information.

constructor

method(config: PromotionActionConfig<T, U>) => PromotionAction

Represents a PromotionAction which applies to individual OrderLines.

Example

Ts
Signature

constructor

method(config: PromotionItemActionConfig<T, U>) => PromotionItemAction

Represents a PromotionAction which applies to the Order as a whole.

Example

Ts
Signature

constructor

method(config: PromotionOrderActionConfig<T, U>) => PromotionOrderAction

Represents a PromotionAction which applies to the shipping cost of an Order.

Signature

constructor

method(config: PromotionShippingActionConfig<T, U>) => PromotionShippingAction

The function which is used by a PromotionItemAction to calculate the discount on the OrderLine for each item.

Signature

The function which is used by a PromotionLineAction to calculate the discount on the OrderLine.

Signature

The function which is used by a PromotionOrderAction to calculate the discount on the Order.

Signature

The function which is used by a PromotionOrderAction to calculate the discount on the Order.

Signature
@vendure/coreSourcev1.8.0Experimental

The signature of a PromotionAction's side-effect functions onActivate and onDeactivate.

Signature

Configuration for all types of PromotionAction.

Signature

priorityValue

propertynumber
Default:0

Used to determine the order of application of multiple Promotions on the same Order. See the Promotion priorityScore field for more information.

conditions

propertyU extends undefined ? undefined : ConditionTuple<Exclude<U, undefined>>

Allows PromotionActions to define one or more PromotionConditions as dependencies. Having a PromotionCondition as a dependency has the following consequences:

  1. A Promotion using this PromotionAction is only valid if it also contains all PromotionConditions on which it depends.
  2. The execute() function will receive a statically-typed state argument which will contain the return values of the PromotionConditions' check() function.

onActivate

propertyPromotionActionSideEffectFn<T>v1.8.0Experimental

An optional side effect function which is invoked when the promotion becomes active. It can be used for things like adding a free gift to the order or other side effects that are unrelated to price calculations.

If used, make sure to use the corresponding onDeactivate function to clean up or reverse any side effects as needed.

onDeactivate

propertyPromotionActionSideEffectFn<T>v1.8.0Experimental

Used to reverse or clean up any side effects executed as part of the onActivate function.

Configuration for a PromotionItemAction

Signature

execute

The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the OrderLine, i.e. the number should be negative.

Configuration for a PromotionLineAction

Signature

execute

The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the OrderLine, i.e. the number should be negative.

Signature

execute

The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the Order, i.e. the number should be negative.

Signature

execute

The function which contains the promotion calculation logic. Should resolve to a number which represents the amount by which to discount the Shipping, i.e. the number should be negative.

Represents a PromotionAction which applies to individual OrderLines. The difference from PromotionItemAction is that it applies regardless of the Quantity of the OrderLine.

Example

Ts
Signature

constructor

method(config: PromotionLineActionConfig<T, U>) => PromotionLineAction
Was this chapter helpful?
Report Issue
Edited Feb 25, 2026ยทEdit this page