docs: improve links to other modules docs (#11868)

This commit is contained in:
Shahed Nasser
2025-03-17 12:17:39 +02:00
committed by GitHub
parent cae47d9e49
commit 857a26ff17
17 changed files with 11484 additions and 10346 deletions
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between API Key Module and Other Modules`,
@@ -12,7 +12,40 @@ This document showcases the module links defined between the API Key Module and
The API Key Module has the following links to other modules:
- [`ApiKey` data model \<\> `SalesChannel` data model of Sales Channel Module](#sales-channel-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[ApiKey](/references/api-key/models/ApiKey)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel) in [Sales Channel Module](../../sales-channel/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#sales-channel-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Cart Module and Other Modules`,
@@ -18,14 +18,140 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Cart` data model \<\> `Customer` data model of Customer Module](#customer-module). (Read-only).
- [`Order` data model of Order Module \<\> `Cart` data model](#order-module).
- [`Cart` data model \<\> `PaymentCollection` data model of Payment Module](#payment-module).
- [`LineItem` data model \<\> `Product` data model of Product Module](#product-module). (Read-only).
- [`LineItem` data model \<\> `ProductVariant` data model of Product Module](#product-module). (Read-only).
- [`Cart` data model \<\> `Promotion` data model of Promotion Module](#promotion-module).
- [`Cart` data model \<\> `Region` data model of Region Module](#region-module). (Read-only).
- [`Cart` data model \<\> `SalesChannel` data model of Sales Channel Module](#sales-channel-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
[Customer](/references/customer/models/Customer) in [Customer Module](../../customer/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#customer-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[LineItem](/references/cart/models/LineItem)
</Table.Cell>
<Table.Cell>
[Product](/references/product/models/Product) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[LineItem](/references/cart/models/LineItem)
</Table.Cell>
<Table.Cell>
[ProductVariant](/references/product/models/ProductVariant) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
[Promotion](/references/promotion/models/Promotion) in [Promotion Module](../../promotion/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#promotion-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
[Region](/references/region/models/Region) in [Region Module](../../region/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#region-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel) in [Sales Channel Module](../../sales-channel/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#sales-channel-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Currency Module and Other Modules`,
@@ -18,15 +18,47 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Currency` data model of Store Module \<\> `Currency` data model of Currency Module](#store-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Store](/references/store/models/Store) in [Store Module](../../store/page.mdx)
</Table.Cell>
<Table.Cell>
[Currency](/references/currency/models/Currency)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#store-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
## Store Module
The Store Module has a `Currency` data model that stores the supported currencies of a store. However, these currencies don't hold all the details of a currency, such as its name or symbol.
Instead, Medusa defines a read-only link between the Currency Module's `Currency` data model and the [Store Module](../../store/page.mdx)'s `Currency` data model. This means you can retrieve the details of a store's supported currencies, but you don't manage the links in a pivot table in the database. The currencies of a store are determined by the `currency_code` of the `Currency` data model in the Store Module.
Instead, Medusa defines a read-only link between the [Store Module](../../store/page.mdx)'s `Currency` data model and the Currency Module's `Currency` data model. Because the link is read-only from the `Store`'s side, you can only retrieve the details of a store's supported currencies, and not the other way around.
### Retrieve with Query
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Customer Module and Other Modules`,
@@ -18,9 +18,69 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Customer` data model \<\> `AccountHolder` data model of Payment Module](#payment-module).
- [`Cart` data model of Cart Module \<\> `Customer` data model](#cart-module). (Read-only).
- [`Order` data model of Order Module \<\> `Customer` data model](#order-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Customer](/references/customer/models/Customer)
</Table.Cell>
<Table.Cell>
[AccountHolder](/references/payment/models/AccountHolder) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[Customer](/references/customer/models/Customer)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Customer](/references/customer/models/Customer)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -120,24 +180,24 @@ createRemoteLinkStep({
## Cart Module
Medusa defines a read-only link between the `Customer` data model and the [Cart Module](../../cart/page.mdx)'s `Cart` data model. This means you can retrieve the details of a customer's carts, but you don't manage the links in a pivot table in the database. The customer of a cart is determined by the `customer_id` property of the `Cart` data model.
Medusa defines a read-only link between the [Cart Module](../../cart/page.mdx)'s `Cart` data model and the `Customer` data model. Because the link is read-only from the `Cart`'s side, you can only retrieve the customer of a cart, and not the other way around.
### Retrieve with Query
To retrieve a customer's carts with [Query](!docs!/learn/fundamentals/module-links/query), pass `carts.*` in `fields`:
To retrieve the customer of a cart with [Query](!docs!/learn/fundamentals/module-links/query), pass `customer.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: customers } = await query.graph({
entity: "customer",
const { data: carts } = await query.graph({
entity: "cart",
fields: [
"carts.*",
"customer.*",
],
})
// customers.carts
// carts.customer
```
</CodeTab>
@@ -148,14 +208,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: customers } = useQueryGraphStep({
entity: "customer",
const { data: carts } = useQueryGraphStep({
entity: "cart",
fields: [
"carts.*",
"customer.*",
],
})
// customers.carts
// carts.customer
```
</CodeTab>
@@ -165,24 +225,24 @@ const { data: customers } = useQueryGraphStep({
## Order Module
Medusa defines a read-only link between the `Customer` data model and the [Order Module](../../order/page.mdx)'s `Order` data model. This means you can retrieve the details of a customer's orders, 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.
Medusa defines a read-only link between the [Order Module](../../order/page.mdx)'s `Order` data model and the `Customer` data model. Because the link is read-only from the `Order`'s side, you can only retrieve the customer of an order, and not the other way around.
### Retrieve with Query
To retrieve a customer's orders with [Query](!docs!/learn/fundamentals/module-links/query), pass `orders.*` in `fields`:
To retrieve the customer of an order with [Query](!docs!/learn/fundamentals/module-links/query), pass `customer.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: customers } = await query.graph({
entity: "customer",
const { data: orders } = await query.graph({
entity: "order",
fields: [
"orders.*",
"customer.*",
],
})
// customers.orders
// orders.customer
```
</CodeTab>
@@ -193,14 +253,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: customers } = useQueryGraphStep({
entity: "customer",
const { data: orders } = useQueryGraphStep({
entity: "order",
fields: [
"orders.*",
"customer.*",
],
})
// customers.orders
// orders.customer
```
</CodeTab>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Fulfillment Module and Other Modules`,
@@ -12,12 +12,110 @@ This document showcases the module links defined between the Fulfillment Module
The Fulfillment Module has the following links to other modules:
- [`Order` data model of the Order Module \<\> `Fulfillment` data model](#order-module).
- [`Return` data model of the Order Module \<\> `Fulfillment` data model](#order-module).
- [`PriceSet` data model of the Pricing Module \<\> `ShippingOption` data model](#pricing-module).
- [`Product` data model of the Product Module \<\> `ShippingProfile` data model](#product-module).
- [`StockLocation` data model of the Stock Location Module \<\> `FulfillmentProvider` data model](#stock-location-module).
- [`StockLocation` data model of the Stock Location Module \<\> `FulfillmentSet` data model](#stock-location-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Fulfillment](/references/fulfillment/models/Fulfillment)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Return](/references/order/models/Return) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Fulfillment](/references/fulfillment/models/Fulfillment)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[PriceSet](/references/pricing/models/PriceSet) in [Pricing Module](../../pricing/page.mdx)
</Table.Cell>
<Table.Cell>
[ShippingOption](/references/fulfillment/models/ShippingOption)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#pricing-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Product](/references/product/models/Product) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
[ShippingProfile](/references/fulfillment/models/ShippingProfile)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation) in [Stock Location Module](../../stock-location/page.mdx)
</Table.Cell>
<Table.Cell>
[FulfillmentProvider](/references/fulfillment/models/FulfillmentProvider)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#stock-location-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation) in [Stock Location Module](../../stock-location/page.mdx)
</Table.Cell>
<Table.Cell>
[FulfillmentSet](/references/fulfillment/models/FulfillmentSet)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#stock-location-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Inventory Module and Other Modules`,
@@ -18,8 +18,54 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`ProductVariant` data model of Product Module \<\> `InventoryItem` data model](#product-module).
- [`InventoryLevel` data model \<\> `StockLocation` data model of Stock Location Module](#stock-location-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[ProductVariant](/references/product/models/ProductVariant) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
[InventoryItem](/references/inventory/models/InventoryItem)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[InventoryLevel](/references/inventory/models/InventoryLevel)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation) in [Stock Location Module](../../stock-location/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#stock-location-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Order Module and Other Modules`,
@@ -18,17 +18,180 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Order` data model \<\> `Customer` data model of Customer Module](#customer-module). (Read-only).
- [`Order` data model \<\> `Cart` data model of Cart Module](#cart-module).
- [`Order` data model \<\> `Fulfillment` data model of Fulfillment Module](#fulfillment-module).
- [`Return` data model \<\> `Fulfillment` data model of Fulfillment Module](#fulfillment-module).
- [`Order` data model \<\> `PaymentCollection` data model of Payment Module](#payment-module).
- [`OrderClaim` data model \<\> `PaymentCollection` data model of Payment Module](#payment-module).
- [`OrderExchange` data model \<\> `PaymentCollection` data model of Payment Module](#payment-module).
- [`Order` data model \<\> `Product` data model of Product Module](#product-module). (Read-only).
- [`Order` data model \<\> `Promotion` data model of Promotion Module](#promotion-module).
- [`Order` data model \<\> `Region` data model of Region Module](#region-module). (Read-only).
- [`Order` data model \<\> `SalesChannel` data model of Sales Channel Module](#sales-channel-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Customer](/references/customer/models/Customer) in [Customer Module](../../customer/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#customer-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Fulfillment](/references/fulfillment/models/Fulfillment) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Return](/references/order/models/Return)
</Table.Cell>
<Table.Cell>
[Fulfillment](/references/fulfillment/models/Fulfillment) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[OrderClaim](/references/order/models/OrderClaim)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[OrderExchange](/references/order/models/OrderExchange)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Product](/references/product/models/Product) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Promotion](/references/promotion/models/Promotion) in [Promotion Module](../../promotion/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#promotion-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[Region](/references/region/models/Region) in [Region Module](../../region/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#region-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel) in [Sales Channel Module](../../sales-channel/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#sales-channel-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Payment Module and Other Modules`,
@@ -12,12 +12,110 @@ This document showcases the module links defined between the Payment Module and
The Payment Module has the following links to other modules:
- [`Cart` data model of Cart Module \<\> `PaymentCollection` data model](#cart-module).
- [`Customer` data model of Customer Module \<\> `AccountHolder` data model](#customer-module).
- [`Order` data model of Order Module \<\> `PaymentCollection` data model](#order-module).
- [`OrderClaim` data model of Order Module \<\> `PaymentCollection` data model](#order-module).
- [`OrderExchange` data model of Order Module \<\> `PaymentCollection` data model](#order-module).
- [`Region` data model of Region Module \<\> `PaymentProvider` data model](#region-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Customer](/references/customer/models/Customer) in [Customer Module](../../customer/page.mdx)
</Table.Cell>
<Table.Cell>
[AccountHolder](/references/payment/models/AccountHolder)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#customer-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[OrderClaim](/references/order/models/OrderClaim) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[OrderExchange](/references/order/models/OrderExchange) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[PaymentCollection](/references/payment/models/PaymentCollection)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Region](/references/region/models/Region) in [Region Module](../../region/page.mdx)
</Table.Cell>
<Table.Cell>
[PaymentProvider](/references/payment/models/PaymentProvider)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#region-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Pricing Module and Other Modules`,
@@ -12,8 +12,54 @@ This document showcases the module links defined between the Pricing Module and
The Pricing Module has the following links to other modules:
- [`ShippingOption` data model of Fulfillment Module \<\> `PriceSet` data model](#fulfillment-module).
- [`ProductVariant` data model of Product Module \<\> `PriceSet` data model](#product-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[ShippingOption](/references/fulfillment/models/ShippingOption) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
[PriceSet](/references/pricing/models/PriceSet)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[ProductVariant](/references/product/models/ProductVariant) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
[PriceSet](/references/pricing/models/PriceSet)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Product Module and Other Modules`,
@@ -18,12 +18,110 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Product` data model \<\> `Cart` data model of Cart Module](#cart-module). (Read-only).
- [`Product` data model \<\> `ShippingProfile` data model of Fulfillment Module](#fulfillment-module).
- [`ProductVariant` data model \<\> `InventoryItem` data model of Inventory Module](#inventory-module).
- [`Product` data model \<\> `Order` data model of Order Module](#order-module). (Read-only).
- [`ProductVariant` data model \<\> `PriceSet` data model of Pricing Module](#pricing-module).
- [`Product` data model \<\> `SalesChannel` data model of Sales Channel Module](#sales-channel-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[Product](/references/product/models/Product)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Product](/references/product/models/Product)
</Table.Cell>
<Table.Cell>
[ShippingProfile](/references/fulfillment/models/ShippingProfile) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[ProductVariant](/references/product/models/ProductVariant)
</Table.Cell>
<Table.Cell>
[InventoryItem](/references/inventory/models/InventoryItem) in [Inventory Module](../../inventory/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#inventory-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Product](/references/product/models/Product)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[ProductVariant](/references/product/models/ProductVariant)
</Table.Cell>
<Table.Cell>
[PriceSet](/references/pricing/models/PriceSet) in [Pricing Module](../../pricing/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#pricing-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Product](/references/product/models/Product)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel) in [Sales Channel Module](../../sales-channel/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#sales-channel-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -31,16 +129,16 @@ Read-only links are used to query data across modules, but the relations aren't
Medusa defines read-only links between:
- The `Product` data model and the [Cart Module](../../cart/page.mdx)'s `LineItem` 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 the `product_id` property of the `LineItem` data model.
- The `ProductVariant` data model and the [Cart Module](../../cart/page.mdx)'s `LineItem` 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 the `variant_id` property of the `LineItem` data model.
- The [Cart Module](../../cart/page.mdx)'s `LineItem` data model and the `Product` data model. Because the link is read-only from the `LineItem`'s side, you can only retrieve the product of a line item, and not the other way around.
- The `ProductVariant` data model and the [Cart Module](../../cart/page.mdx)'s `LineItem` data model. Because the link is read-only from the `LineItem`'s side, you can only retrieve the variant of a line item, and not the other way around.
### Retrieve with Query
To retrieve the line items of a variant with [Query](!docs!/learn/fundamentals/module-links/query), pass `line_items.*` in `fields`:
To retrieve the variant of a line item with [Query](!docs!/learn/fundamentals/module-links/query), pass `variant.*` in `fields`:
<Note>
To retrieve the line items of a product, pass `line_items.*` in `fields`.
To retrieve the product, pass `product.*` in `fields`.
</Note>
@@ -48,14 +146,14 @@ To retrieve the line items of a product, pass `line_items.*` in `fields`.
<CodeTab label="query.graph" value="method">
```ts
const { data: variants } = await query.graph({
entity: "variant",
const { data: lineItems } = await query.graph({
entity: "line_item",
fields: [
"line_items.*",
"variant.*",
],
})
// variants.line_items
// lineItems.variant
```
</CodeTab>
@@ -66,14 +164,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: variants } = useQueryGraphStep({
entity: "variant",
const { data: lineItems } = useQueryGraphStep({
entity: "line_item",
fields: [
"line_items.*",
"variant.*",
],
})
// variants.line_items
// lineItems.variant
```
</CodeTab>
@@ -281,16 +379,16 @@ createRemoteLinkStep({
Medusa defines read-only links between:
- the `Product` data model and the [Order Module](../../order/page.mdx)'s `OrderLineItem` 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 the `product_id` property of the `OrderLineItem` data model.
- the `ProductVariant` data model and the [Order Module](../../order/page.mdx)'s `OrderLineItem` 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 the `variant_id` property of the `OrderLineItem` data model.
- the [Order Module](../../order/page.mdx)'s `OrderLineItem` data model and the `Product` data model. Because the link is read-only from the `OrderLineItem`'s side, you can only retrieve the product of an order line item, and not the other way around.
- the [Order Module](../../order/page.mdx)'s `OrderLineItem` data model and the `ProductVariant` data model. Because the link is read-only from the `OrderLineItem`'s side, you can only retrieve the variant of an order line item, and not the other way around.
### Retrieve with Query
To retrieve the order line items of a variant with [Query](!docs!/learn/fundamentals/module-links/query), pass `order_items.*` in `fields`:
To retrieve the variant of a line item with [Query](!docs!/learn/fundamentals/module-links/query), pass `variant.*` in `fields`:
<Note>
To retrieve a product's order line items, pass `order_items.*` in `fields`.
To retrieve the product, pass `product.*` in `fields`.
</Note>
@@ -298,14 +396,14 @@ To retrieve a product's order line items, pass `order_items.*` in `fields`.
<CodeTab label="query.graph" value="method">
```ts
const { data: variants } = await query.graph({
entity: "variant",
const { data: lineItems } = await query.graph({
entity: "order_line_item",
fields: [
"order_items.*",
"variant.*",
],
})
// variants.order_items
// lineItems.variant
```
</CodeTab>
@@ -316,14 +414,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: variants } = useQueryGraphStep({
entity: "variant",
const { data: lineItems } = useQueryGraphStep({
entity: "order_line_item",
fields: [
"order_items.*",
"variant.*",
],
})
// variants.order_items
// lineItems.variant
```
</CodeTab>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Promotion Module and Other Modules`,
@@ -18,9 +18,68 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Cart` data model of the Cart Module \<\> `Promotion` data model](#cart-module).
- [`LineItemAdjustment` data model of the Cart Module \<\> `Promotion` data model](#cart-module). (Read-only).
- [`Order` data model of the Order Module \<\> `Promotion` data model](#order-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[Promotion](/references/promotion/models/Promotion)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[LineItemAdjustment](/references/cart/models/LineItemAdjustment) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[Promotion](/references/promotion/models/Promotion)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Promotion](/references/promotion/models/Promotion)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -30,7 +89,7 @@ A promotion can be applied on line items and shipping methods of a cart. Medusa
![A diagram showcasing an example of how data models from the Cart and Promotion modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1711538015/Medusa%20Resources/cart-promotion_kuh9vm.jpg)
Medusa also defines a read-only link between the `Promotion` data model and the [Cart Module](../../cart/page.mdx)'s `LineItemAdjustment` data model. This means you can retrieve the details of the promotion applied on a line item, but you don't manage the links in a pivot table in the database. The promotion of a line item is determined by the `promotion_id` property of the `LineItemAdjustment` data model.
Medusa also defines a read-only link between the [Cart Module](../../cart/page.mdx)'s `LineItemAdjustment` data model and the `Promotion` data model. Because the link is read-only from the `LineItemAdjustment`'s side, you can only retrieve the promotion applied on a line item, and not the other way around.
### Retrieve with Query
@@ -38,7 +97,7 @@ To retrieve the carts that a promotion is applied on with [Query](!docs!/learn/f
<Note>
To retrieve the line item adjustments of a promotion, pass `line_item_adjustments.*` in `fields`.
To retrieve the promotion of a line item adjustment, pass `promotion.*` in `fields`.
</Note>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Region Module and Other Modules`,
@@ -18,32 +18,91 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Region` data model \<\> `Cart` data model of the Cart Module](#cart-module). (Read-only)
- [`Region` data model \<\> `Order` data model of the Order Module](#order-module). (Read-only)
- [`Region` data model \<\> `PaymentProvider` data model of the Payment Module](#payment-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[Region](/references/region/models/Region)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[Region](/references/region/models/Region)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Region](/references/region/models/Region)
</Table.Cell>
<Table.Cell>
[PaymentProvider](/references/payment/models/PaymentProvider) in [Payment Module](../../payment/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#payment-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
## Cart Module
Medusa defines a read-only link between the `Region` data model and the [Cart Module](../../cart/page.mdx)'s `Cart` data model. This means you can retrieve the details of a region's carts, but you don't manage the links in a pivot table in the database. The region of a cart is determined by the `region_id` property of the `Cart` data model.
Medusa defines a read-only link between the [Cart Module](../../cart/page.mdx)'s `Cart` data model and the `Region` data model. Because the link is read-only from the `Cart`'s side, you can only retrieve the region of a cart, and not the other way around.
### Retrieve with Query
To retrieve the carts of a region with [Query](!docs!/learn/fundamentals/module-links/query), pass `carts.*` in `fields`:
To retrieve the region of a cart with [Query](!docs!/learn/fundamentals/module-links/query), pass `region.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: regions } = await query.graph({
entity: "region",
const { data: carts } = await query.graph({
entity: "cart",
fields: [
"carts.*",
"region.*",
],
})
// regions.carts
// carts.region
```
</CodeTab>
@@ -54,14 +113,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: regions } = useQueryGraphStep({
entity: "region",
const { data: carts } = useQueryGraphStep({
entity: "cart",
fields: [
"carts.*",
"region.*",
],
})
// regions.carts
// carts.region
```
</CodeTab>
@@ -71,24 +130,24 @@ const { data: regions } = useQueryGraphStep({
## Order Module
Medusa defines a read-only link between the `Region` data model and the [Cart Module](../../cart/page.mdx)'s `Cart` data model. This means you can retrieve the details of a region's orders, 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.
Medusa defines a read-only link between the [Order Module](../../order/page.mdx)'s `Order` data model and the `Region` data model. Because the link is read-only from the `Order`'s side, you can only retrieve the region of an order, and not the other way around.
### Retrieve with Query
To retrieve the orders of a region with [Query](!docs!/learn/fundamentals/module-links/query), pass `orders.*` in `fields`:
To retrieve the region of an order with [Query](!docs!/learn/fundamentals/module-links/query), pass `region.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: regions } = await query.graph({
entity: "region",
const { data: orders } = await query.graph({
entity: "order",
fields: [
"orders.*",
"region.*",
],
})
// regions.orders
// orders.region
```
</CodeTab>
@@ -99,14 +158,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: regions } = useQueryGraphStep({
entity: "region",
const { data: orders } = useQueryGraphStep({
entity: "order",
fields: [
"orders.*",
"region.*",
],
})
// regions.orders
// orders.region
```
</CodeTab>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Sales Channel Module and Other Modules`,
@@ -18,11 +18,96 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`ApiKey` data model of the API Key Module \<\> `SalesChannel` data model](#api-key-module).
- [`SalesChannel` data model \<\> `Cart` data model of the Cart Module](#cart-module). (Read-only)
- [`SalesChannel` data model \<\> `Order` data model of the Order Module](#order-module). (Read-only)
- [`Product` data model of the Product Module \<\> `SalesChannel` data model](#product-module).
- [`SalesChannel` data model \<\> `StockLocation` data model of the Stock Location Module](#stock-location-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[ApiKey](/references/api-key/models/ApiKey) in [API Key Module](../../api-key/page.mdx)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#api-key-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Cart](/references/cart/models/Cart) in [Cart Module](../../cart/page.mdx)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#cart-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Order](/references/order/models/Order) in [Order Module](../../order/page.mdx)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#order-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Product](/references/product/models/Product) in [Product Module](../../product/page.mdx)
</Table.Cell>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#product-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation) in [Stock Location Module](../../stock-location/page.mdx)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#stock-location-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -121,24 +206,24 @@ createRemoteLinkStep({
## Cart Module
Medusa defines a read-only link between the `SalesChannel` data model and the [Cart Module](../../cart/page.mdx)'s `Cart` data model. This means you can retrieve the details of a sales channel's carts, but you don't manage the links in a pivot table in the database. The sales channel of a cart is determined by the `sales_channel_id` property of the `Cart` data model.
Medusa defines a read-only link between the [Cart Module](../../cart/page.mdx)'s `Cart` data model and the `SalesChannel` data model. Because the link is read-only from the `Cart`'s side, you can only retrieve the sales channel of a cart, and not the other way around.
### Retrieve with Query
To retrieve the carts of a sales channel with [Query](!docs!/learn/fundamentals/module-links/query), pass `carts.*` in `fields`:
To retrieve the sales channel of a cart with [Query](!docs!/learn/fundamentals/module-links/query), pass `sales_channel.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: salesChannels } = await query.graph({
entity: "sales_channel",
const { data: carts } = await query.graph({
entity: "cart",
fields: [
"carts.*",
"sales_channel.*",
],
})
// salesChannels.carts
// carts.sales_channel
```
</CodeTab>
@@ -149,14 +234,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: salesChannels } = useQueryGraphStep({
entity: "sales_channel",
const { data: carts } = useQueryGraphStep({
entity: "cart",
fields: [
"carts.*",
"sales_channel.*",
],
})
// salesChannels.carts
// carts.sales_channel
```
</CodeTab>
@@ -166,24 +251,24 @@ const { data: salesChannels } = useQueryGraphStep({
## Order Module
Medusa defines a read-only link between the `SalesChannel` data model and the [Order Module](../../order/page.mdx)'s `Order` data model. This means you can retrieve the details of a sales channel's orders, 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.
Medusa defines a read-only link between the [Order Module](../../order/page.mdx)'s `Order` data model and the `SalesChannel` data model. Because the link is read-only from the `Order`'s side, you can only retrieve the sales channel of an order, and not the other way around.
### Retrieve with Query
To retrieve the orders of a sales channel with [Query](!docs!/learn/fundamentals/module-links/query), pass `orders.*` in `fields`:
To retrieve the sales channel of an order with [Query](!docs!/learn/fundamentals/module-links/query), pass `sales_channel.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: salesChannels } = await query.graph({
entity: "sales_channel",
const { data: orders } = await query.graph({
entity: "order",
fields: [
"orders.*",
"sales_channel.*",
],
})
// salesChannels.orders
// orders.sales_channel
```
</CodeTab>
@@ -194,14 +279,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: salesChannels } = useQueryGraphStep({
entity: "sales_channel",
const { data: orders } = useQueryGraphStep({
entity: "order",
fields: [
"orders.*",
"sales_channel.*",
],
})
// salesChannels.orders
// orders.sales_channel
```
</CodeTab>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Stock Location Module and Other Modules`,
@@ -18,10 +18,82 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`FulfillmentSet` data model of the Fulfillment Module \<\> `StockLocation` data model](#fulfillment-module).
- [`FulfillmentProvider` data model of the Fulfillment Module \<\> `StockLocation` data model](#fulfillment-module).
- [`StockLocation` data model \<\> `Inventory` data model of the Inventory Module](#inventory-module).
- [`SalesChannel` data model of the Sales Channel Module \<\> `StockLocation` data model](#sales-channel-module).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[FulfillmentSet](/references/fulfillment/models/FulfillmentSet) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[FulfillmentProvider](/references/fulfillment/models/FulfillmentProvider) in [Fulfillment Module](../../fulfillment/page.mdx)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#fulfillment-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[Inventory](/references/inventory/models/Inventory) in [Inventory Module](../../inventory/page.mdx)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#inventory-module)
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
[SalesChannel](/references/sales-channel/models/SalesChannel) in [Sales Channel Module](../../sales-channel/page.mdx)
</Table.Cell>
<Table.Cell>
[StockLocation](/references/stock-location/models/StockLocation)
</Table.Cell>
<Table.Cell>
Stored
</Table.Cell>
<Table.Cell>
[Learn more](#sales-channel-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -130,24 +202,24 @@ createRemoteLinkStep({
## Inventory Module
Medusa defines a read-only link between the `StockLocation` data model and the [Inventory Module](../../inventory/page.mdx)'s `InventoryLevel` data model. This means you can retrieve the details of a stock location's inventory levels, but you don't manage the links in a pivot table in the database. The stock location of an inventory level is determined by the `location_id` property of the `InventoryLevel` data model.
Medusa defines a read-only link between the [Inventory Module](../../inventory/page.mdx)'s `InventoryLevel` data model and the `StockLocation` data model. Because the link is read-only from the `InventoryLevel`'s side, you can only retrieve the stock location of an inventory level, and not the other way around.
### Retrieve with Query
To retrieve the inventory levels of a stock location with [Query](!docs!/learn/fundamentals/module-links/query), pass `inventory_levels.*` in `fields`:
To retrieve the stock locations of an inventory level with [Query](!docs!/learn/fundamentals/module-links/query), pass `stock_locations.*` in `fields`:
<CodeTabs group="relation-query">
<CodeTab label="query.graph" value="method">
```ts
const { data: stockLocations } = await query.graph({
entity: "stock_location",
const { data: inventoryLevels } = await query.graph({
entity: "inventory_level",
fields: [
"inventory_levels.*",
"stock_locations.*",
],
})
// stockLocations.inventory_levels
// inventoryLevels.stock_locations
```
</CodeTab>
@@ -158,14 +230,14 @@ import { useQueryGraphStep } from "@medusajs/medusa/core-flows"
// ...
const { data: stockLocations } = useQueryGraphStep({
entity: "stock_location",
const { data: inventoryLevels } = useQueryGraphStep({
entity: "inventory_level",
fields: [
"inventory_levels.*",
"stock_locations.*",
],
})
// stockLocations.inventory_levels
// inventoryLevels.stock_locations
```
</CodeTab>
@@ -1,4 +1,4 @@
import { CodeTabs, CodeTab } from "docs-ui"
import { CodeTabs, CodeTab, Table } from "docs-ui"
export const metadata = {
title: `Links between Store Module and Other Modules`,
@@ -18,7 +18,40 @@ Read-only links are used to query data across modules, but the relations aren't
</Note>
- [`Currency` data model \<\> `Currency` data model of Currency Module](#currency-module). (Read-only).
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
First Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Second Data Model
</Table.HeaderCell>
<Table.HeaderCell>
Type
</Table.HeaderCell>
<Table.HeaderCell>
Description
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
[Store](/references/store/models/Store)
</Table.Cell>
<Table.Cell>
[Currency](/references/currency/models/Currency) in [Currency Module](../../currency/page.mdx)
</Table.Cell>
<Table.Cell>
Read-only
</Table.Cell>
<Table.Cell>
[Learn more](#currency-module)
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
---
@@ -26,7 +59,7 @@ Read-only links are used to query data across modules, but the relations aren't
The Store Module has a `Currency` data model that stores the supported currencies of a store. However, these currencies don't hold all the details of a currency, such as its name or symbol.
Instead, Medusa defines a read-only link between the [Currency Module](../../currency/page.mdx)'s `Currency` data model and the Store Module's `Currency` data model. This means you can retrieve the details of a store's supported currencies, but you don't manage the links in a pivot table in the database. The currencies of a store are determined by the `currency_code` of the `Currency` data model in the Store Module.
Instead, Medusa defines a read-only link between the [Currency Module](../../currency/page.mdx)'s `Currency` data model and the Store Module's `Currency` data model. This means you can retrieve the details of a store's supported currencies, but you don't manage the links in a pivot table in the database. The currencies of a store are determined by the `currency_code` of the [Currency](/references/store/models/Currency) data model in the Store Module (not in the Currency Module).
### Retrieve with Query
+15 -15
View File
@@ -2107,21 +2107,21 @@ export const generatedEditDates = {
"app/admin-components/components/forms/page.mdx": "2024-10-09T12:48:04.229Z",
"app/commerce-modules/auth/reset-password/page.mdx": "2025-02-26T11:18:00.391Z",
"app/storefront-development/customers/reset-password/page.mdx": "2025-03-04T09:15:25.662Z",
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2025-01-06T11:19:22.450Z",
"app/commerce-modules/api-key/links-to-other-modules/page.mdx": "2025-03-14T14:33:38.886Z",
"app/commerce-modules/cart/extend/page.mdx": "2024-12-25T12:48:59.149Z",
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.593Z",
"app/commerce-modules/cart/links-to-other-modules/page.mdx": "2025-03-14T14:33:26.754Z",
"app/commerce-modules/customer/extend/page.mdx": "2024-12-25T15:54:37.789Z",
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2025-02-11T12:10:04.901Z",
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2025-02-03T12:37:33.622Z",
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.607Z",
"app/commerce-modules/fulfillment/links-to-other-modules/page.mdx": "2025-03-14T14:37:12.681Z",
"app/commerce-modules/inventory/links-to-other-modules/page.mdx": "2025-03-14T14:38:15.246Z",
"app/commerce-modules/pricing/links-to-other-modules/page.mdx": "2025-03-14T14:41:14.683Z",
"app/commerce-modules/product/extend/page.mdx": "2024-12-11T09:07:25.252Z",
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2025-02-11T12:09:46.420Z",
"app/commerce-modules/product/links-to-other-modules/page.mdx": "2025-03-14T15:07:30.349Z",
"app/commerce-modules/promotion/extend/page.mdx": "2024-12-11T09:07:24.137Z",
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.608Z",
"app/commerce-modules/promotion/links-to-other-modules/page.mdx": "2025-03-17T06:48:23.706Z",
"app/commerce-modules/order/edit/page.mdx": "2025-02-26T11:24:28.852Z",
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.604Z",
"app/commerce-modules/order/links-to-other-modules/page.mdx": "2025-03-14T14:39:37.366Z",
"app/commerce-modules/order/order-change/page.mdx": "2024-10-09T09:59:40.745Z",
"app/commerce-modules/payment/links-to-other-modules/page.mdx": "2025-01-31T09:22:05.326Z",
"app/commerce-modules/payment/links-to-other-modules/page.mdx": "2025-03-14T14:40:25.733Z",
"references/core_flows/Common/Steps_Common/functions/core_flows.Common.Steps_Common.useQueryGraphStep/page.mdx": "2025-01-13T17:30:23.157Z",
"references/core_flows/Payment/Workflows_Payment/functions/core_flows.Payment.Workflows_Payment.processPaymentWorkflow/page.mdx": "2025-03-04T13:33:44.884Z",
"references/helper_steps/functions/helper_steps.useQueryGraphStep/page.mdx": "2025-01-17T16:43:22.242Z",
@@ -2169,10 +2169,10 @@ export const generatedEditDates = {
"references/fulfillment/interfaces/fulfillment.IFulfillmentModuleService/page.mdx": "2024-12-17T16:57:25.097Z",
"references/types/CommonTypes/interfaces/types.CommonTypes.RequestQueryFields/page.mdx": "2024-12-09T13:21:32.865Z",
"references/utils/utils.ProductUtils/page.mdx": "2025-02-24T10:48:43.141Z",
"app/commerce-modules/region/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.617Z",
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.620Z",
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2025-01-06T11:19:35.619Z",
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2024-12-24T14:58:24.038Z",
"app/commerce-modules/region/links-to-other-modules/page.mdx": "2025-03-14T15:08:31.803Z",
"app/commerce-modules/sales-channel/links-to-other-modules/page.mdx": "2025-03-14T15:09:08.416Z",
"app/commerce-modules/stock-location/links-to-other-modules/page.mdx": "2025-03-14T15:04:43.112Z",
"app/commerce-modules/store/links-to-other-modules/page.mdx": "2025-03-17T06:52:04.187Z",
"app/examples/page.mdx": "2025-02-04T07:36:39.956Z",
"app/medusa-cli/commands/build/page.mdx": "2024-11-11T11:00:49.665Z",
"app/js-sdk/page.mdx": "2025-02-05T09:12:11.479Z",
@@ -5726,8 +5726,8 @@ export const generatedEditDates = {
"app/commerce-modules/store/admin-widget-zones/page.mdx": "2024-12-24T08:46:28.646Z",
"app/commerce-modules/tax/admin-widget-zones/page.mdx": "2024-12-24T08:47:13.176Z",
"app/commerce-modules/user/admin-widget-zones/page.mdx": "2024-12-24T08:48:14.186Z",
"app/commerce-modules/currency/links-to-other-modules/page.mdx": "2024-12-24T14:47:10.556Z",
"app/commerce-modules/customer/links-to-other-modules/page.mdx": "2025-01-31T09:26:54.541Z",
"app/commerce-modules/currency/links-to-other-modules/page.mdx": "2025-03-17T06:41:29.161Z",
"app/commerce-modules/customer/links-to-other-modules/page.mdx": "2025-03-14T15:18:39.759Z",
"app/commerce-modules/fulfillment/events/page.mdx": "2024-12-31T09:37:49.253Z",
"app/commerce-modules/payment/events/page.mdx": "2024-12-31T09:41:56.582Z",
"references/core_flows/Payment/Steps_Payment/functions/core_flows.Payment.Steps_Payment.refundPaymentsStep/page.mdx": "2025-03-04T13:33:44.866Z",