Links between Order Module and Other Modules
This document showcases the module links defined between the Order Module and other Commerce Modules.
Summary#
The Order Module has the following links to other modules:
First Data Model | Second Data Model | Type | Description |
---|---|---|---|
Read-only - has one | |||
Cart in Cart Module | Stored - one-to-one | ||
Stored - one-to-many | |||
Stored - one-to-many | |||
Stored - one-to-many | |||
Stored - one-to-many | |||
Stored - one-to-many | |||
Read-only - has many | |||
Stored - many-to-many | |||
Read-only - has one | |||
Read-only - has one |
Customer Module#
Medusa defines a read-only link between the Order
data model and the Customer Module's Customer
data model. This means you can retrieve the details of an order's customer, but you don't manage the links in a pivot table in the database. The customer of an order is determined by the customer_id
property of the Order
data model.
Retrieve with Query#
To retrieve the customer of an order with Query, pass customer.*
in fields
:
Cart Module#
The Cart Module provides cart-management features.
Medusa defines a link between the Order
and Cart
data models. The order is linked to the cart used for the purchased.
Retrieve with Query#
To retrieve the cart of an order with Query, pass cart.*
in fields
:
Manage with Link#
To manage the cart of an order, use Link:
Fulfillment Module#
A fulfillment is created for an orders' items. Medusa defines a link between the Fulfillment
and Order
data models.
A fulfillment is also created for a return's items. So, Medusa defines a link between the Fulfillment
and Return
data models.
Retrieve with Query#
To retrieve the fulfillments of an order with Query, pass fulfillments.*
in fields
:
fulfillments.*
in fields
.Manage with Link#
To manage the fulfillments of an order, use Link:
Payment Module#
An order's payment details are stored in a payment collection. This also applies for claims and exchanges.
So, Medusa defines links between the PaymentCollection
data model and the Order
, OrderClaim
, and OrderExchange
data models.
Retrieve with Query#
To retrieve the payment collections of an order, order exchange, or order claim with Query, pass payment_collections.*
in fields
:
Manage with Link#
To manage the payment collections of an order, use Link:
Product Module#
Medusa defines read-only links between:
- the
OrderLineItem
data model and the Product Module'sProduct
data model. This means you can retrieve the details of a line item's product, but you don't manage the links in a pivot table in the database. The product of a line item is determined by theproduct_id
property of theOrderLineItem
data model. - the
OrderLineItem
data model and the Product Module'sProductVariant
data model. This means you can retrieve the details of a line item's variant, but you don't manage the links in a pivot table in the database. The variant of a line item is determined by thevariant_id
property of theOrderLineItem
data model.
Retrieve with Query#
To retrieve the variant of a line item with Query, pass variant.*
in fields
:
product.*
in fields
.Promotion Module#
An order is associated with the promotion applied on it. Medusa defines a link between the Order
and Promotion
data models.
Retrieve with Query#
To retrieve the promotion applied on an order with Query, pass promotion.*
in fields
:
Manage with Link#
To manage the promotion of an order, use Link:
Region Module#
Medusa defines a read-only link between the Order
data model and the Region Module's Region
data model. This means you can retrieve the details of an order's region, but you don't manage the links in a pivot table in the database. The region of an order is determined by the region_id
property of the Order
data model.
Retrieve with Query#
To retrieve the region of an order with Query, pass region.*
in fields
:
Sales Channel Module#
Medusa defines a read-only link between the Order
data model and the Sales Channel Module's SalesChannel
data model. This means you can retrieve the details of an order's sales channel, but you don't manage the links in a pivot table in the database. The sales channel of an order is determined by the sales_channel_id
property of the Order
data model.
Retrieve with Query#
To retrieve the sales channel of an order with Query, pass sales_channel.*
in fields
: