A hook is the moment when a rule runs. When you create a new rule, you pick which hook it’s attached to — and that choice determines two things: when the rule fires, and what data is available to it.
The five hooks
| Hook | When it runs | Available data |
|---|---|---|
| Order Import | When an order is imported from a sales channel | The order, including line items, customer, addresses, and totals |
| Shipment Notification | When tracking information is received from the warehouse | The shipment and the original order it came from |
| Return Import | When a return is imported | The return, including return line items |
| Purchase Order Import | When a purchase order is imported | The purchase order, including line items |
| Invoice Export | When an invoice is being exported to an external system | The invoice and the original order it came from |
Cross-context data
Two hooks expose more than just their primary record. Shipment Notification rules can reference the parent order — useful when you want to make decisions based on customer details that aren’t on the shipment itself. Invoice Export rules work the same way.
For example, in a Shipment Notification rule you can write conditions against shipment.tracking_number (from the shipment) and order.customer_email (from the parent order) in the same expression.
Picking a hook
Use this guide:
- Want to change something about an incoming order before fulfillment? Order Import.
- Want to add a tracking-number prefix or suppress a notification email? Shipment Notification.
- Need to route returns differently based on the original order? Return Import.
- Replenishment workflow? Purchase Order Import.
- Customizing the format of an outgoing invoice? Invoice Export.
If you’re not sure, Your First Rule walks through the most common case (Order Import) end-to-end.
Comments
Please sign in to leave a comment.