The default OrderRecalculationStrategy which never triggers a read-time recalculation. This preserves the behaviour of Vendure prior to v3.8.0, where an active Order's prices are only re-calculated on write mutations.
OrderRecalculationStrategyThis strategy determines whether an active Order's prices, promotions, taxes and shipping
promotions should be re-calculated when the Order is read (e.g. via the activeOrder query).
Recalculation is only ever attempted for Orders in the AddingItems state.
Note: the shipping method and rate are NOT re-evaluated on read, so a read never silently
swaps the customer's chosen method — those are re-evaluated when the Order transitions to
ArrangingPayment (checkout). Shipping promotions are re-tested, so a now-inactive shipping
promotion's discount is cleared rather than surviving on the Order.
The default NoOrderRecalculationStrategy never triggers a recalculation, preserving the historical behaviour whereby an active Order's prices are only updated on write mutations. Use TtlOrderRecalculationStrategy (or a custom implementation) to keep long-lived carts in sync with changing product prices and promotions.
This is configured via the orderOptions.orderRecalculationStrategy property of your VendureConfig.
InjectableStrategy(ctx: RequestContext, order: Order) => boolean | Promise<boolean>Return true to trigger a recalculation of the Order's prices, promotions and taxes before
it is returned from the active-order read path.
Note: Implementations should rely only on fields that are always present on the Order
(e.g. pricingUpdatedAt, state, active). Deep relations (lines, promotions, etc.) may
not be loaded on the Order passed to this method.
An OrderRecalculationStrategy which recalculates an active Order when the time since its
last recalculation exceeds the configured ttlMs. This mirrors the "price freeze period" model
used by other e-commerce platforms: quoted prices remain stable for a period, then refresh on the
next access.
Example
OrderRecalculationStrategy(ctx: RequestContext, order: Order) => booleanOptions passed to OrderService.applyPriceAdjustments and OrderCalculator.applyPriceAdjustments.
booleanWhether the shipping method & rate should be re-evaluated — which may swap the Order's
shipping method to a different eligible one. Defaults to true.
booleanWhen recalculateShipping is false (the chosen shipping method & rate are left
untouched), this controls whether shipping promotions are still re-tested and their
adjustments cleared/re-applied. Defaults to the value of recalculateShipping, so
callers that freeze shipping entirely (e.g. order modification) are unaffected, while
read-time recalculation can drop a now-inactive shipping promotion's discount without
re-selecting the method.
Architecture reviews, custom plugin work, migrations, ongoing support. Get a hand from the team that builds Vendure.
Talk to the team