Skip to main content

Order

Responsible for orders: the aggregate, its line items, and address snapshots. The order state machine and placement flow are documented in Flows.

Tables​

TableDescription
order_ordersOrders — public order_code, status + payment status, currency_id and shipping snapshots, coupon snapshot (coupon_id, coupon_code, discount_amount), expires_at
order_order_itemsOrder line items with per-item price snapshots plus promotion facts (base_price, promotion_discount, promotion_id)
order_order_addressesBilling/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​

EndpointAudiencePurpose
GET /order/user/ordersUserOrder history — includes created_at and the line items per order
GET /order/user/orders/{code}UserOrder detail (payment-status polling after hosted checkout)
GET /order/admin/statsAdminDashboard 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​

EventWhen
OrderCreatedEventCheckout creates the order (dispatched with the request locale)
OrderPaidEventA settled payment marks the order paid
OrderShippedEventThe order is marked shipped (directly or via the Shipping mirror)
OrderCompletedEventThe order is marked completed (directly or via the Shipping mirror)
OrderCancelledEventCancelled by the customer or by the scheduled expiry command
OrderRefundedEventThe payment status moves to refunded
OrderPendingEventReserved 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.