Order
Responsible for orders: the aggregate, its line items, and address snapshots. The order state machine and placement flow are documented in Flows.
Tables
| Table | Description |
|---|---|
order_orders | Orders — public order_code, status + payment status, currency_id and shipping snapshots, coupon snapshot (coupon_id, coupon_code, discount_amount), expires_at |
order_order_items | Order line items with per-item price snapshots plus promotion facts (base_price, promotion_discount, promotion_id) |
order_order_addresses | Billing/shipping address snapshots per order |
Discount snapshots keep invoices self-contained: promoted items record their base price and the per-unit discount actually applied, and the order keeps the coupon code and amount consumed at checkout (see Discount).
Endpoints
| Endpoint | Audience | Purpose |
|---|---|---|
GET /order/user/orders | User | Order history — includes created_at and the line items per order |
GET /order/user/orders/{code} | User | Order detail (payment-status polling after hosted checkout) |
GET /order/admin/stats | Admin | Dashboard stats — see below |
GET /order/admin/stats powers the admin dashboard: total revenue (paid
orders only) with month-over-month change, a zero-filled 12-month revenue
series and 30-day order series, counts by status, top products by units
sold, and the latest orders.
Events emitted
| Event | When |
|---|---|
OrderCreatedEvent | Checkout creates the order (dispatched with the request locale) |
OrderPaidEvent | A settled payment marks the order paid |
OrderShippedEvent | The order is marked shipped (directly or via the Shipping mirror) |
OrderCompletedEvent | The order is marked completed (directly or via the Shipping mirror) |
OrderCancelledEvent | Cancelled by the customer or by the scheduled expiry command |
OrderRefundedEvent | The payment status moves to refunded |
OrderPendingEvent | Reserved contract — not dispatched yet |
Scheduled work
order:cancel-expired (registered on the scheduler) cancels pending,
unpaid orders past their expires_at and dispatches
OrderCancelledEvent. Deployments without a worker-based scheduler need
a cron entry — see Shared hosting.
Dependencies
None — the Order module is a leaf. Other modules (Cart, Payment,
Shipping) call it through its Core gateway (OrderGatewayInterface):
createFromCart, markAsPaid, markAsShipped, markAsDelivered.