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.Unique order identifier (prefix:
order_)Auto-incrementing display ID for customer reference
Custom display ID (e.g., “ORD-2024-001”)
Order status:
pending, completed, archived, canceledOrder version number (increments with changes)
ID of the customer who placed the order
Customer email address
Three-letter ISO currency code
ID of the associated region
ID of the sales channel where order was placed
Whether this is a draft order (default: false)
Order line items
Shipping address for the order
Billing address for the order
Shipping methods applied to the order
Payment transactions
Order totals summary by version
Returns associated with this order
OrderItem
Represents a line item in an order.Unique item identifier
ID of the parent order
Order version when item was added
Reference to the cart line item
ID of the product
ID of the product variant
Item quantity
Price per unit
Detailed line item information including totals
OrderLineItem
Detailed line item with pricing and tax information.Unique line item identifier
Line item title
Line item subtitle
Product thumbnail URL
Item quantity
Price per unit before discounts
Tax lines applied to this item
Discount adjustments applied to this item
OrderChange
Tracks modifications to an order.Unique change identifier
ID of the order being changed
Order version this change applies to
Type of change:
return, exchange, claim, editChange status:
pending, requested, confirmed, declined, canceledUser ID who requested the change
User ID who confirmed the change
Individual actions in this change
Return
Represents a product return.Unique return identifier (prefix:
return_)ID of the order being returned
Return status
Items being returned
Stock location where items will be returned
OrderClaim
Represents a customer claim for damaged or incorrect items.Unique claim identifier
ID of the order being claimed
Items being claimed
OrderExchange
Represents an item exchange.Unique exchange identifier
ID of the order
Items being exchanged
Service Interface
The Order Module service is available at@medusajs/medusa/order.
Retrieve Order
Retrieve a single order with related data.The ID of the order to retrieve
The retrieved order
List Orders
List orders with filtering and pagination.Array of orders matching the filters
Total count of matching orders
Create Orders
Create one or more orders (typically from a cart).Order data to create
ID of the customer
Customer email
Three-letter ISO currency code
ID of the region
Order line items
Shipping address
Billing address
The created order(s)
Update Orders
Update order information.Create Order Change
Initiate a change to an order.Confirm Order Change
Confirm and apply an order change.Create Return
Create a product return.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