Overview
The Order Module manages the complete order lifecycle including order creation, modifications, fulfillment tracking, returns, claims, and exchanges. It provides versioning support for order changes and maintains detailed transaction history. Key Features:- Order management with status tracking
- Order versioning for change history
- Line items with tax lines and adjustments
- Shipping methods with tax and adjustments
- Returns, claims, and exchanges
- Order changes with approval workflow
- Transaction tracking
- Credit lines for store credit
When to Use
Use the Order Module when you need to:- Create orders from completed carts
- Track order status and fulfillment
- Handle order modifications and cancellations
- Process customer returns
- Manage product claims and replacements
- Handle order exchanges
- Apply discounts and promotions to orders
- Track payment transactions
Data Models
Order
The core order entity representing a customer purchase.string
required
Unique order identifier (prefix:
order_)number
required
Auto-incrementing display ID for customer reference
string
Custom display ID (e.g., “ORD-2024-001”)
OrderStatus
required
Order status:
pending, completed, archived, cancelednumber
required
Order version number (increments with changes)
string
ID of the customer who placed the order
string
Customer email address
string
required
Three-letter ISO currency code
string
ID of the associated region
string
ID of the sales channel where order was placed
boolean
Whether this is a draft order (default: false)
OrderItem[]
Order line items
OrderAddress
Shipping address for the order
OrderAddress
Billing address for the order
OrderShippingMethod[]
Shipping methods applied to the order
OrderTransaction[]
Payment transactions
OrderSummary[]
Order totals summary by version
Return[]
Returns associated with this order
OrderItem
Represents a line item in an order.string
required
Unique item identifier
string
required
ID of the parent order
number
required
Order version when item was added
string
required
Reference to the cart line item
string
ID of the product
string
ID of the product variant
number
required
Item quantity
BigNumber
required
Price per unit
OrderLineItem
Detailed line item information including totals
OrderLineItem
Detailed line item with pricing and tax information.string
required
Unique line item identifier
string
required
Line item title
string
Line item subtitle
string
Product thumbnail URL
number
required
Item quantity
BigNumber
required
Price per unit before discounts
OrderLineItemTaxLine[]
Tax lines applied to this item
OrderLineItemAdjustment[]
Discount adjustments applied to this item
OrderChange
Tracks modifications to an order.string
required
Unique change identifier
string
required
ID of the order being changed
number
required
Order version this change applies to
string
Type of change:
return, exchange, claim, editOrderChangeStatus
required
Change status:
pending, requested, confirmed, declined, canceledstring
User ID who requested the change
string
User ID who confirmed the change
OrderChangeAction[]
Individual actions in this change
Return
Represents a product return.string
required
Unique return identifier (prefix:
return_)string
required
ID of the order being returned
string
Return status
ReturnItem[]
Items being returned
string
Stock location where items will be returned
OrderClaim
Represents a customer claim for damaged or incorrect items.string
required
Unique claim identifier
string
required
ID of the order being claimed
OrderClaimItem[]
Items being claimed
OrderExchange
Represents an item exchange.string
required
Unique exchange identifier
string
required
ID of the order
OrderExchangeItem[]
Items being exchanged
Service Interface
The Order Module service is available at@medusajs/medusa/order.
Retrieve Order
Retrieve a single order with related data.string
required
The ID of the order to retrieve
FindConfig
OrderDTO
The retrieved order
List Orders
List orders with filtering and pagination.FilterableOrderProps
OrderDTO[]
Array of orders matching the filters
number
Total count of matching orders
Create Orders
Create one or more orders (typically from a cart).CreateOrderDTO | CreateOrderDTO[]
required
OrderDTO | OrderDTO[]
The created order(s)
Update Orders
Update order information.Create Order Change
Initiate a change to an order.CreateOrderChangeDTO
required
Confirm Order Change
Confirm and apply an order change.Create Return
Create a product return.CreateReturnDTO | CreateReturnDTO[]
required
Create Order Claim
Create a claim for damaged or incorrect items.Create Order Exchange
Create an item exchange.Integration Examples
With Cart Module
Orders are typically created from completed carts.With Payment Module
Track payment transactions for orders.With Fulfillment Module
Create fulfillments for order items.Best Practices
- Order Versioning: The order version increments with each modification. Always reference the version when making changes.
- Order Changes: Use the OrderChange entity for tracking modifications. This provides an audit trail and approval workflow.
-
Status Management: Follow the order status flow:
pending→completed→archived. Usecanceledfor cancelled orders. - Transaction Tracking: Create OrderTransaction entries for all payment-related activities to maintain a complete financial record.
- Returns and Exchanges: Use dedicated return and exchange entities rather than modifying the original order.
-
Display IDs: Use
display_idfor customer-facing order numbers. Optionally setcustom_display_idfor custom formatting.
Related Modules
- Cart Module - Create orders from carts
- Payment Module - Process order payments
- Fulfillment Module - Fulfill order items
- Inventory Module - Reserve and adjust inventory
- Customer Module - Associate orders with customers