docs: fix issues in product builder tutorial (#13505)
This commit is contained in:
@@ -764,7 +764,7 @@ You also pass the product builder record to the compensation function, which del
|
||||
|
||||
The `prepareProductBuilderCustomFieldsStep` receives the custom fields from the workflow's input and returns which custom fields should be created, updated, or deleted.
|
||||
|
||||
To create the step, create the file `src/workflows/upsert-product-builder.ts` with the following content:
|
||||
To create the step, create the file `src/workflows/steps/prepare-product-builder-custom-fields.ts` with the following content:
|
||||
|
||||
export const prepareCustomFieldsStepHighlights = [
|
||||
["21", "listProductBuilderCustomFields", "Get existing custom fields."],
|
||||
@@ -772,7 +772,7 @@ export const prepareCustomFieldsStepHighlights = [
|
||||
["27", "toUpdate", "Custom fields to update."]
|
||||
]
|
||||
|
||||
```ts title="src/workflows/upsert-product-builder.ts" highlights={prepareCustomFieldsStepHighlights}
|
||||
```ts title="src/workflows/steps/prepare-product-builder-custom-fields.ts" highlights={prepareCustomFieldsStepHighlights}
|
||||
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
|
||||
import { PRODUCT_BUILDER_MODULE } from "../../modules/product-builder"
|
||||
|
||||
@@ -822,7 +822,7 @@ export const prepareCustomFieldsStepHighlights2 = [
|
||||
["26", "toDelete", "Add the custom field to this array if it exists but isn't in the input."]
|
||||
]
|
||||
|
||||
```ts title="src/workflows/upsert-product-builder.ts" highlights={prepareCustomFieldsStepHighlights2}
|
||||
```ts title="src/workflows/steps/prepare-product-builder-custom-fields.ts" highlights={prepareCustomFieldsStepHighlights2}
|
||||
// Process input fields to determine creates vs updates
|
||||
input.custom_fields?.forEach((fieldData) => {
|
||||
const existingField = existingCustomFields.find((f) => f.id === fieldData.id)
|
||||
@@ -1671,6 +1671,8 @@ when({
|
||||
.then(() => {
|
||||
dismissRemoteLinkStep(deletedComplementaryProductLinks)
|
||||
})
|
||||
|
||||
// TODO manage addon products
|
||||
```
|
||||
|
||||
In this portion of the workflow, you:
|
||||
|
||||
Reference in New Issue
Block a user