Skip to main content

Promotion Action

PromotionAction

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.

PromotionItemAction

Represents a PromotionAction which applies to individual OrderLines.

Example

Ts
Signature

PromotionOrderAction

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

Example

Ts
Signature

PromotionShippingAction

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

Signature

ExecutePromotionItemActionFn

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

Signature

ExecutePromotionLineActionFn

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

Signature

ExecutePromotionOrderActionFn

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

Signature

ExecutePromotionShippingActionFn

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

Signature

PromotionActionSideEffectFn

@vendure/coreSourcev1.8.0Experimental

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

Signature

PromotionActionConfig

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.

PromotionItemActionConfig

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.

PromotionLineActionConfig

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.

PromotionOrderActionConfig

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.

PromotionShippingActionConfig

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.

PromotionLineAction

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
Was this chapter helpful?
Report Issue
Edited Apr 20, 2026ยทEdit this page