🚨 Announcing Vendure v2 Beta

StockAllocationStrategy

StockAllocationStrategy

This strategy is responsible for deciding at which stage in the order process stock will be allocated.

Signature

interface StockAllocationStrategy extends InjectableStrategy {
  shouldAllocateStock(
        ctx: RequestContext,
        fromState: OrderState,
        toState: OrderState,
        order: Order,
    ): boolean | Promise<boolean>;
}

Extends

Members

shouldAllocateStock

method
type:
(ctx: RequestContext, fromState: OrderState, toState: OrderState, order: Order) => boolean | Promise<boolean>
This method is called whenever an Order transitions from one state to another. If it resolves to true, then stock will be allocated for this order.