docs: fix pricing query params in storefront guide + modules restructure (#9021)

- Fix pricing query params previously using `customer_group_id` and `customer_id` as expected / accepted queries and update information around them
- Other: reorganize the introduction page of each module to show how to use it at the very beginning.
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-09-09 06:43:43 +00:00
1 parent afb83b2408
commit 3eb2387746
20 files changed
+973 -964

No files matched your search

@@ -8,6 +8,73 @@ export const metadata = {
The Fulfillment Module is the `@medusajs/fulfillment` NPM package that provides fulfillment-related features in your Medusa and Node.js applications.
## How to Use Fulfillment Module's Service
You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.API_KEY` imported from `@medusajs/utils`.
For example:
<CodeTabs groupId="resource-type">
<CodeTab label="API Route" value="api-route">
```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
export async function GET(
req: MedusaRequest,
res: MedusaResponse
): Promise<void> {
const fulfillmentModuleService: IFulfillmentModuleService = req.scope.resolve(
ModuleRegistrationName.FULFILLMENT
)
res.json({
fulfillments: await fulfillmentModuleService.listFulfillments(),
})
}
```
</CodeTab>
<CodeTab label="Subscriber" value="subscribers">
```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
ModuleRegistrationName.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/workflows-sdk"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
const step1 = createStep("step-1", async (_, { container }) => {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
ModuleRegistrationName.FULFILLMENT
)
const fulfillments = await fulfillmentModuleService.listFulfillments()
})
```
</CodeTab>
</CodeTabs>
---
## Features
### Fulfillment Management
@@ -101,70 +168,3 @@ const fulfillmentSets = await fulfillmentModuleService.createFulfillmentSets([
## Configure Fulfillment Module
Refer to [this documentation](./module-options/page.mdx) for details on the module's options.
---
## How to Use Fulfillment Module's Service
You can use the Fulfillment Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.API_KEY` imported from `@medusajs/utils`.
For example:
<CodeTabs groupId="resource-type">
<CodeTab label="API Route" value="api-route">
```ts title="src/api/store/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
export async function GET(
req: MedusaRequest,
res: MedusaResponse
): Promise<void> {
const fulfillmentModuleService: IFulfillmentModuleService = req.scope.resolve(
ModuleRegistrationName.FULFILLMENT
)
res.json({
fulfillments: await fulfillmentModuleService.listFulfillments(),
})
}
```
</CodeTab>
<CodeTab label="Subscriber" value="subscribers">
```ts title="src/subscribers/custom-handler.ts"
import { SubscriberArgs } from "@medusajs/medusa"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
export default async function subscriberHandler({ container }: SubscriberArgs) {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
ModuleRegistrationName.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/workflows-sdk"
import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
const step1 = createStep("step-1", async (_, { container }) => {
const fulfillmentModuleService: IFulfillmentModuleService = container.resolve(
ModuleRegistrationName.FULFILLMENT
)
const fulfillments = await fulfillmentModuleService.listFulfillments()
})
```
</CodeTab>
</CodeTabs>