Skip to content
← Back to Index

OnOrderCalculate ​

This hook runs after the OnOrderPlan hook and any commands it returned have been applied to the Order Actor, and before the OnOrderValidate hook. OnOrderPlan itself runs after OnOrderCommands.

It is intended for derived calculations that depend on the enriched and planned order state — for example calculating tax after another rule has enriched order line prices and fulfillment planning has settled. Its output is in turn visible to OnOrderValidate rules.

Commands returned from this hook are applied to the order, but do not re-trigger OnOrderCommands, OnOrderPlan, OnOrderCalculate or OnOrderValidate. The hook runs once per message.

Type ​

filtrera
{
  hook: 'OnOrderCalculate'
  before: Order // The order before the incoming message commands were applied
  order: Order // The order after OnOrderPlan has run
}

Effects ​

validationError Reverts the order state and returns the error to the caller.
messageActor Sends a message to another actor. Responses are ignored.
scheduleJob Schedules a job.
sendEmail Queues an email for delivery through the Sendings system.
orderCommand Applies a command to the order. Commands returned from OnOrderCalculate do not re-trigger OnOrderCommands, OnOrderCalculate or OnOrderValidate.

© 2026 Hantera AB. Org. no.: 559242-9582