When to use it
Use it to design a tracking page, to map carrier events into your order system, or to teach support agents what each status means. The main line runs from booking to delivery, and the side paths, failed delivery, pickup point, refusal and exceptions, are the cases support handles every day.
Make it yours
- Rename states to the wording your customers see.
- With several carriers, define your own states first and map each carrier's codes to them.
- Same-day local delivery has no transfers, so remove the hub and facility states.
Mermaid code
stateDiagram-v2
[*] --> OrderPlaced : Sender books shipment
OrderPlaced --> PickedUp : Courier collects
OrderPlaced --> Cancelled : Cancelled before pickup
PickedUp --> InTransit : Sent to sorting hub
InTransit --> InTransit : Transfer
InTransit --> AtLocalFacility : Arrives in destination city
InTransit --> Exception : Damaged or bad address
AtLocalFacility --> OutForDelivery : Courier departs
OutForDelivery --> Delivered : Signed by recipient
OutForDelivery --> DeliveryFailed : Nobody home
DeliveryFailed --> OutForDelivery : Rescheduled
DeliveryFailed --> AtPickupPoint : Left at locker or shop
AtPickupPoint --> Delivered : Collected
OutForDelivery --> Returned : Recipient refuses
Exception --> InTransit : Resolved
Exception --> Returned : Cannot be resolved
Returned --> [*]
Delivered --> [*]
Cancelled --> [*]Ask an AI for one with this structure
Send the prompt below to ChatGPT or Claude, then paste the whole reply into the editor; the code inside is detected automatically.
Draw a parcel tracking state diagram with Mermaid stateDiagram-v2 syntax. The main line is OrderPlaced, PickedUp, InTransit, AtLocalFacility, OutForDelivery, Delivered. A shipment can be cancelled before pickup. InTransit can loop on a transfer or move to Exception. OutForDelivery can lead to DeliveryFailed or Returned. DeliveryFailed can be rescheduled or moved to AtPickupPoint, which ends in Delivered. An exception is resolved back to InTransit or ends in Returned. Use state names without spaces, write the trigger after a colon, and mark start and end. Output only the mermaid code block.
FAQ
- What does the arrow from InTransit to itself mean?
The state stays the same while an event occurs, here a transfer at a hub. That is how a tracking history shows several transit entries.
- There are many states and the lines cross.
Drag states in the preview to put the main line in a column and the side paths on either side.
- Is there a template for order status?
Yes. The order status and refund status state diagrams in the library combine with this one into a full post-purchase picture.
More in this category
Updated 2026-11-11