docs: edits and fixes to commerce module docs (#7468)
Apply edits and fixes to the commerce modules docs
This commit is contained in:
@@ -10,7 +10,7 @@ In this document, you’ll learn about some basic fulfillment concepts.
|
||||
|
||||
A fulfillment set is a general form or way of fulfillment. For example, shipping is a form of fulfillment, and pick-up is another form of fulfillment. Each of these can be created as fulfillment sets.
|
||||
|
||||
A fulfillment set is represented by the `FulfillmentSet` data model. All other configurations, options, and management features are related to a fulfillment set, in one way or another. So, the first step when using the Fulfillment Module is to create a fulfillment set.
|
||||
A fulfillment set is represented by the [FulfillmentSet data model](/references/fulfillment/models/FulfillmentSet). All other configurations, options, and management features are related to a fulfillment set, in one way or another.
|
||||
|
||||
```ts
|
||||
const fulfillmentSets = await fulfillmentModuleService.create(
|
||||
@@ -33,13 +33,11 @@ const fulfillmentSets = await fulfillmentModuleService.create(
|
||||
|
||||
A service zone is a collection of geographical zones or areas. It’s used to restrict available shipping options to a defined set of locations.
|
||||
|
||||
A service zone is represented by the `ServiceZone` data model. It’s associated with a fulfillment set, as each service zone is specific to a form of fulfillment. For example, if a customer chooses to pick up items, you can restrict the available shipping options based on their location.
|
||||
A service zone is represented by the [ServiceZone data model](/references/fulfillment/models/ServiceZone). It’s associated with a fulfillment set, as each service zone is specific to a form of fulfillment. For example, if a customer chooses to pick up items, you can restrict the available shipping options based on their location.
|
||||
|
||||
A fulfillment set can have multiple service zones, each restricting different locations.
|
||||

|
||||
|
||||

|
||||
|
||||
A service zone can have multiple geographical zones, each represented by the `GeoZone` data model. It holds location-related details to narrow down supported areas, such as country, city, or province code.
|
||||
A service zone can have multiple geographical zones, each represented by the [GeoZone data model](/references/fulfillment/models/GeoZone). It holds location-related details to narrow down supported areas, such as country, city, or province code.
|
||||
|
||||
---
|
||||
|
||||
@@ -47,4 +45,4 @@ A service zone can have multiple geographical zones, each represented by the `Ge
|
||||
|
||||
A shipping profile defines a type of items that are shipped in a similar manner. For example, a `default` shipping profile is used for all item types, but the `digital` shipping profile is used for digital items that aren’t shipped and delivered conventionally.
|
||||
|
||||
A shipping profile is represented by the `ShippingProfile` data model. It only defines the profile’s details, but it’s associated with the shipping options available for the item type.
|
||||
A shipping profile is represented by the [ShippingProfile data model](/references/fulfillment/models/ShippingProfile). It only defines the profile’s details, but it’s associated with the shipping options available for the item type.
|
||||
|
||||
@@ -8,4 +8,10 @@ export const metadata = {
|
||||
|
||||
Find in this reference the list of events emitted by the Fulfillment Module.
|
||||
|
||||
<Note type="soon">
|
||||
|
||||
Events are still in development, so this reference will change in the future.
|
||||
|
||||
</Note>
|
||||
|
||||
<EventsTable />
|
||||
@@ -1,25 +1,27 @@
|
||||
export const metadata = {
|
||||
title: `Fulfillment Provider`,
|
||||
title: `Fulfillment Provider Module`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this document, you’ll learn what a fulfillment provider is.
|
||||
In this document, you’ll learn what a fulfillment provider module is.
|
||||
|
||||
## What’s a Fulfillment Provider?
|
||||
## What’s a Fulfillment Provider Module?
|
||||
|
||||
A fulfillment provider implements the functionality of fulfilling items, typically using a third-party integration. It’s represented by the `FulfillmentProvider` data model.
|
||||
A fulfillment provider module handles fulfilling items, typically using a third-party integration.
|
||||
|
||||
---
|
||||
|
||||
## How to Create a Fulfillment Provider?
|
||||
|
||||
A fulfillment provider is a TypeScript or JavaScript class that extends the `AbstractFulfillmentProviderService` class imported from `@medusajs/utils`. You can create it part of your Medusa application codebase, in a plugin, or in a provider module.
|
||||
Fulfillment provider modules are stored and represented by the [FulfillmentProvider data model](/references/fulfillment/models/FulfillmentProvider).
|
||||
|
||||
---
|
||||
|
||||
## Configure Fulfillment Providers
|
||||
|
||||
The Fulfillment Module accepts a `providers` option that allows you to register providers in your application. When the Medusa application starts, it registers these modules and adds records of the `FulfillmentProvider` for them.
|
||||
The Fulfillment Module accepts a `providers` option that allows you to register providers in your application.
|
||||
|
||||
Learn more about the `providers` option in [this documentation](../module-options/page.mdx).
|
||||
|
||||
---
|
||||
|
||||
## How to Create a Fulfillment Provider?
|
||||
|
||||
Refer to [this guide](/references/fulfillment/provider) to learn how to create a fulfillment provider module.
|
||||
|
||||
@@ -8,7 +8,7 @@ In this document, you’ll learn about the concepts of item fulfillment.
|
||||
|
||||
## Fulfillment Data Model
|
||||
|
||||
A fulfillment is the shipping and delivery of one or more items to the customer. It’s represented by the `Fulfillment` data model.
|
||||
A fulfillment is the shipping and delivery of one or more items to the customer. It’s represented by the [Fulfillment data model](/references/fulfillment/models/Fulfillment).
|
||||
|
||||
---
|
||||
|
||||
@@ -18,7 +18,7 @@ A fulfillment is associated with a fulfillment provider that handles all its pro
|
||||
|
||||
The fulfillment is also associated with a shipping option of that provider, which determines how the item is shipped.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
@@ -36,7 +36,7 @@ A fulfillment is used to fulfill one or more items. Each item is represented by
|
||||
|
||||
The fulfillment item holds details relevant to fulfilling the item, such as barcode, SKU, and quantity to fulfill.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ In this document, you'll learn about the options of the Fulfillment Module.
|
||||
|
||||
## providers
|
||||
|
||||
The `providers` option is an array of either fulfillment provider modules, fulfillment plugins, or path to a file that holds a fulfillment provider.
|
||||
The `providers` option is an array of fulfillment provider modules.
|
||||
|
||||
When the Medusa application starts, these providers are registered and can be used to process fulfillments.
|
||||
|
||||
@@ -29,6 +29,13 @@ const modules = {
|
||||
providers: [
|
||||
{
|
||||
resolve: `@medusajs/fulfillment-manual`,
|
||||
options: {
|
||||
config: {
|
||||
manual: {
|
||||
// provider options...
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -38,5 +45,6 @@ const modules = {
|
||||
|
||||
The `providers` option is an array of objects that accept the following properties:
|
||||
|
||||
- `resolve`: A string indicating the package name of the fulfillment provider module or the fulfillment plugin, or the path to the file defining the fulfillment provider.
|
||||
- `options`: An optional object of options to pass to the fulfillment provider.
|
||||
- `resolve`: A string indicating either the package name of the fulfillment provider module or the path to it.
|
||||
- `options`: An optional object of the fulfillment provider module's options. The object must have the following property:
|
||||
- `config`: An object whose key is the ID of the fulfillment provider, and its value is an object of options to pass to the provider module.
|
||||
@@ -8,13 +8,11 @@ export const metadata = {
|
||||
|
||||
The Fulfillment Module is the `@medusajs/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
### Fulfillment Management
|
||||
|
||||
Create fulfillments and keep track of their statuses, items, and more.
|
||||
Create fulfillments and keep track of their status, items, and more.
|
||||
|
||||
```ts
|
||||
const fulfillment =
|
||||
@@ -46,7 +44,6 @@ Use third-party fulfillment providers to provide customers with shipping options
|
||||
```ts
|
||||
const shippingOption =
|
||||
await fulfillmentModuleService.createShippingOptions({
|
||||
name: "Express shipping",
|
||||
// ...
|
||||
provider_id: "webshipper",
|
||||
})
|
||||
@@ -109,12 +106,14 @@ const fulfillmentSets = await fulfillmentModuleService.create(
|
||||
|
||||
## Configure Fulfillment Module
|
||||
|
||||
After installing the `@medusajs/fulfillment` package in your Medusa application, add it to the `modules` object in `medusa-config.js`:
|
||||
To use the Fulfillment Module, enable it in the `modules` object in `medusa-config.js`:
|
||||
|
||||
```js title="medusa-config.js"
|
||||
const { Modules } = require("@medusajs/modules-sdk")
|
||||
|
||||
const modules = {
|
||||
// ...
|
||||
fulfillment: {
|
||||
[Modules.FULFILLMENT]: {
|
||||
resolve: "@medusajs/fulfillment",
|
||||
providers: [
|
||||
// ...
|
||||
@@ -184,11 +183,14 @@ For example:
|
||||
import { IFulfillmentModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||
|
||||
const step1 = createStep("step-1", async (_, context) => {
|
||||
const step1 = createStep(
|
||||
"step-1",
|
||||
async (_, { container }) => {
|
||||
const fulfillmentModuleService: IFulfillmentModuleService =
|
||||
context.container.resolve(
|
||||
container.resolve(
|
||||
ModuleRegistrationName.FULFILLMENT
|
||||
)
|
||||
|
||||
const fulfillments =
|
||||
await fulfillmentModuleService.listFulfillments()
|
||||
})
|
||||
|
||||
+18
-6
@@ -4,14 +4,26 @@ export const metadata = {
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
When Commerce Modules are used together in a Medusa application, the Medusa application handles building the relations between these modules.
|
||||
This document showcases the link modules defined between the Fulfillment Module and other commerce modules.
|
||||
|
||||
This document showcases the relation 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
|
||||
|
||||
When the Fulfillment and Stock Location modules are used together, a fulfillment set can be conditioned to a specific stock location.
|
||||
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.
|
||||
|
||||
The Medusa application forms a relation between the `FulfillmentSet` and `StockLocation` data models.
|
||||
|
||||

|
||||

|
||||
|
||||
+11
-11
@@ -1,5 +1,5 @@
|
||||
export const metadata = {
|
||||
title: `Shipping Options`,
|
||||
title: `Shipping Option`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
@@ -12,21 +12,21 @@ A shipping option is a way of shipping an item. Each fulfillment provider provid
|
||||
|
||||
When the customer places their order, they choose a shipping option to be used to fulfill their items.
|
||||
|
||||
A shipping option is represented by the `ShippingOption` data model.
|
||||
A shipping option is represented by the [ShippingOption data model](/references/fulfillment/models/ShippingOption).
|
||||
|
||||
---
|
||||
|
||||
## Service Zone Restrictions
|
||||
|
||||
A shipping option is restricted by a service zone, which specifies in what locations can a shipping option be used.
|
||||
A shipping option is restricted by a service zone, limiting the locations a shipping option be used in.
|
||||
|
||||
For example, a fulfillment provider may have a shipping option that can be used in the United States, and another in Canada.
|
||||
|
||||

|
||||

|
||||
|
||||
Service zones can be more restrictive, such as restricting to certain cities or province codes.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
@@ -34,26 +34,26 @@ Service zones can be more restrictive, such as restricting to certain cities or
|
||||
|
||||
You can restrict shipping options by custom rules, such as the item’s weight or the customer’s group.
|
||||
|
||||
These rules are represented by the `ShippingOptionRule` data model. Its fields define the custom rule:
|
||||
These rules are represented by the [ShippingOptionRule data model](/references/fulfillment/models/ShippingOptionRule). Its fields define the custom rule:
|
||||
|
||||
- `field`: The name of an field or table that the rule applies to. For example, `customer_group`.
|
||||
- `value`: One or more values.
|
||||
- `attribute`: The name of a field or table that the rule applies to. For example, `customer_group`.
|
||||
- `operator`: The operator used in the condition. For example:
|
||||
- To allow multiple values, use the operator `in`, which validates that the provided values are in the rule’s values.
|
||||
- To create a negation condition that considers `value` against the rule, use `nin`, which validates that the provided values aren’t in the rule’s values.
|
||||
- Check out more operators in [this reference](/references/fulfillment/types/fulfillment.RuleOperatorType).
|
||||
- `value`: One or more values.
|
||||
|
||||

|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
## Shipping Profile and Types
|
||||
|
||||
A shipping option belongs to a type. For example, a shipping option’s type may be `express`, while another `standard`. The type is represented by the `ShippingOptionType` data model.
|
||||
A shipping option belongs to a type. For example, a shipping option’s type may be `express`, while another `standard`. The type is represented by the [ShippingOptionType data model](/references/fulfillment/models/ShippingOptionType).
|
||||
|
||||
A shipping option also belongs to a shipping profile, as each shipping profile defines the type of items to be shipped in a similar manner.
|
||||
|
||||
Reference in New Issue
Block a user