docs: improved commerce module docs [2/n] (#9501)
Improve + add docs for commerce modules from currency to inventory [2/n]
This commit is contained in:
@@ -10,7 +10,7 @@ In this document, you’ll learn what a fulfillment module provider is.
|
||||
|
||||
A fulfillment module provider handles fulfilling items, typically using a third-party integration.
|
||||
|
||||
Fulfillment module providers are stored and represented by the [FulfillmentProvider data model](/references/fulfillment/models/FulfillmentProvider).
|
||||
Fulfillment module providers registered in the Fulfillment Module's [options](../module-options/page.mdx) are stored and represented by the [FulfillmentProvider data model](/references/fulfillment/models/FulfillmentProvider).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ A fulfillment is the shipping and delivery of one or more items to the customer.
|
||||
|
||||
---
|
||||
|
||||
## Fulfillment Processing
|
||||
## Fulfillment Processing by a Fulfillment Provider
|
||||
|
||||
A fulfillment is associated with a fulfillment provider that handles all its processing, such as creating a shipment for the fulfillment’s items.
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
export const metadata = {
|
||||
title: `Links between Fulfillment Module and Other Modules`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This document showcases the module links defined between the Fulfillment Module and other commerce modules.
|
||||
|
||||
## Order Module
|
||||
|
||||
The Order Module provides order-management functionalities.
|
||||
|
||||
Medusa defines a link between the `Fulfillment` and `Order` data models. A fulfillment is created for an orders' items.
|
||||
|
||||

|
||||
|
||||
A fulfillment is also created for a return's items. So, Medusa defines a link between the `Fulfillment` and `Return` data models.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Pricing Module
|
||||
|
||||
The Pricing Module provides features to store, manage, and retrieve the best prices in a specified context.
|
||||
|
||||
Medusa defines a link between the `PriceSet` and `ShippingOption` data models. A shipping option's price is stored as a price set.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Stock Location Module
|
||||
|
||||
The Stock Location Module provides features to manage stock locations in a store.
|
||||
|
||||
Medusa defines a link between the `FulfillmentSet` and `StockLocation` data models. A fulfillment set can be conditioned to a specific stock location.
|
||||
|
||||

|
||||
|
||||
Medusa also defines a link between the `FulfillmentProvider` and `StockLocation` data models to indicate the providers that can be used in a location.
|
||||
|
||||

|
||||
@@ -6,7 +6,7 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
The Fulfillment Module is the `@medusajs/medusa/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications.
|
||||
The Fulfillment Module provides fulfillment-related features in your Medusa and Node.js applications.
|
||||
|
||||
## How to Use Fulfillment Module's Service
|
||||
|
||||
@@ -15,18 +15,33 @@ You can use the Fulfillment Module's main service by resolving from the Medusa c
|
||||
For example:
|
||||
|
||||
<CodeTabs groupId="resource-type">
|
||||
<CodeTab label="Workflow Step" value="workflow-step">
|
||||
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/framework/workflows-sdk"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const fulfillmentModuleService = container.resolve(
|
||||
Modules.FULFILLMENT
|
||||
)
|
||||
|
||||
const fulfillments = await fulfillmentModuleService.listFulfillments()
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
<CodeTab label="API Route" value="api-route">
|
||||
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { IFulfillmentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const fulfillmentModuleService: IFulfillmentModuleService = req.scope.resolve(
|
||||
const fulfillmentModuleService = req.scope.resolve(
|
||||
Modules.FULFILLMENT
|
||||
)
|
||||
|
||||
@@ -39,35 +54,17 @@ export async function GET(
|
||||
</CodeTab>
|
||||
<CodeTab label="Subscriber" value="subscribers">
|
||||
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/framework"
|
||||
import { IFulfillmentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/framework"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
|
||||
const fulfillmentModuleService = container.resolve(
|
||||
Modules.FULFILLMENT
|
||||
)
|
||||
|
||||
const fulfillments = await fulfillmentModuleService.listFulfillments()
|
||||
}
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
<CodeTab label="Workflow Step" value="workflow-step">
|
||||
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/framework/workflows-sdk"
|
||||
import { IFulfillmentModuleService } from "@medusajs/framework/types"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
|
||||
Modules.FULFILLMENT
|
||||
)
|
||||
|
||||
const fulfillments = await fulfillmentModuleService.listFulfillments()
|
||||
})
|
||||
```
|
||||
|
||||
</CodeTab>
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
export const metadata = {
|
||||
title: `Relations between Fulfillment Module and Other Modules`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
This document showcases the link modules defined between the Fulfillment Module and other commerce modules.
|
||||
|
||||
## Order Module
|
||||
|
||||
A fulfillment is created for an orders' items. Medusa defines a link module that builds a relationship between the `Fulfillment` and `Order` data models.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Pricing Module
|
||||
|
||||
A shipping option's price is stored as a price set. Medusa defines a link module that builds a relationship between the `PriceSet` and `ShippingOption` data models.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## Stock Location Module
|
||||
|
||||
A fulfillment set can be conditioned to a specific stock location. Medusa defines a link module that builds a relationship between the `FulfillmentSet` and `StockLocation` data models.
|
||||
|
||||

|
||||
@@ -45,7 +45,7 @@ These rules are represented by the [ShippingOptionRule data model](/references/f
|
||||
|
||||

|
||||
|
||||
A shipping option can have multiple rules. For example, a shipping option is available if the customer belongs to the VIP group and the total weight is less than 2000g.
|
||||
A shipping option can have multiple rules. For example, you can add rules to a shipping option so that it's available if the customer belongs to the VIP group and the total weight is less than 2000g.
|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user