docs: fix typo in extend core flow (#10709)

* docs: fix typo in extend core flow

* small fixes
This commit is contained in:
Shahed Nasser
2024-12-23 18:10:31 +02:00
committed by GitHub
parent 13ddf27c68
commit a4335f2a47
2 changed files with 6 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ Learn more about the workflow hooks in [this chapter](../../../fundamentals/work
</Note>
The [createProductsWorkflow](!resources!/references/medusa-workflows/createProductsWorkflow) used in the [Create Product API route](!api!/admin#products_postproducts) has a `productsCreated` hook that runs after the product is created. You'll consume this hook to link the created product with the brand specified in the request paramters.
The [createProductsWorkflow](!resources!/references/medusa-workflows/createProductsWorkflow) used in the [Create Product API route](!api!/admin#products_postproducts) has a `productsCreated` hook that runs after the product is created. You'll consume this hook to link the created product with the brand specified in the request parameters.
To consume the `productsCreated` hook, create the file `src/workflows/hooks/created-product.ts` with the following content:
@@ -171,7 +171,7 @@ In the compensation function, if the `links` parameter isn't empty, you resolve
Now that you've consumed the `productCreated` hook, you want to configure the `/admin/products` API route that creates a new product to accept a brand ID in its `additional_data` parameter.
You configure the properties accepted in `additional_data` in the `src/api/middlewares.ts` that exports middleware configurations. So, create `src/api/middlewares.ts` with the following content:
You configure the properties accepted in `additional_data` in the `src/api/middlewares.ts` that exports middleware configurations. So, create the file (or, if already existing, add to the file) `src/api/middlewares.ts` the following content:
![Directory structure after adding the middelwares file](https://res.cloudinary.com/dza7lstvk/image/upload/v1733386868/Medusa%20Book/brands-middleware-dir-overview_uczos1.jpg)
@@ -179,8 +179,11 @@ You configure the properties accepted in `additional_data` in the `src/api/middl
import { defineMiddlewares } from "@medusajs/framework/http"
import { z } from "zod"
// ...
export default defineMiddlewares({
routes: [
// ...
{
matcher: "/admin/products",
method: ["POST"],

View File

@@ -86,7 +86,7 @@ export const generatedEditDates = {
"app/learn/customization/custom-features/api-route/page.mdx": "2024-12-09T10:39:30.046Z",
"app/learn/customization/custom-features/module/page.mdx": "2024-12-09T14:36:02.100Z",
"app/learn/customization/custom-features/workflow/page.mdx": "2024-12-09T14:36:29.482Z",
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-09T12:59:23.364Z",
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-12-23T15:42:23.863Z",
"app/learn/customization/custom-features/page.mdx": "2024-12-09T10:46:28.593Z",
"app/learn/customization/customize-admin/page.mdx": "2024-12-09T11:02:38.801Z",
"app/learn/customization/customize-admin/route/page.mdx": "2024-12-09T15:32:46.656Z",