docs: add missing step in product builder guide (#13370)
This commit is contained in:
1 parent
b4c0f131b7
commit
bafe110352
3 files changed
+34
-9
No files matched your search
@@ -68634,6 +68634,18 @@ After that, you use the [addToCartWorkflow](https://docs.medusajs.com/references
|
|||||||
Next, you need to add the complementary and addon product variants to the cart. Replace the `TODO` with the following:
|
Next, you need to add the complementary and addon product variants to the cart. Replace the `TODO` with the following:
|
||||||
|
|
||||||
```ts title="src/workflows/add-product-builder-to-cart.ts" highlights={addProductBuilderToCartWorkflowHighlights3}
|
```ts title="src/workflows/add-product-builder-to-cart.ts" highlights={addProductBuilderToCartWorkflowHighlights3}
|
||||||
|
// Step 4: Get cart after main product is added
|
||||||
|
const { data: cartWithMainProduct } = useQueryGraphStep({
|
||||||
|
entity: "cart",
|
||||||
|
fields: ["*", "items.*"],
|
||||||
|
filters: {
|
||||||
|
id: input.cart_id,
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
throwIfKeyNotFound: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Step 5: Add complementary and addon products
|
// Step 5: Add complementary and addon products
|
||||||
const {
|
const {
|
||||||
items_to_add: moreItemsToAdd,
|
items_to_add: moreItemsToAdd,
|
||||||
|
|||||||
@@ -4615,17 +4615,30 @@ After that, you use the [addToCartWorkflow](/references/medusa-workflows/addToCa
|
|||||||
Next, you need to add the complementary and addon product variants to the cart. Replace the `TODO` with the following:
|
Next, you need to add the complementary and addon product variants to the cart. Replace the `TODO` with the following:
|
||||||
|
|
||||||
export const addProductBuilderToCartWorkflowHighlights3 = [
|
export const addProductBuilderToCartWorkflowHighlights3 = [
|
||||||
["3", "items_to_add", "Complementary and addon items to add to the cart."],
|
["2", "cartWithMainProduct", "Refetch the cart with the main product added."],
|
||||||
["4", "main_item_update", "Update main product line item metadata."],
|
["15", "items_to_add", "Complementary and addon items to add to the cart."],
|
||||||
["30", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."],
|
["16", "main_item_update", "Update main product line item metadata."],
|
||||||
["37", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."],
|
["42", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."],
|
||||||
["38", "is_addon", "Set `is_addon` flag for addon products."],
|
["49", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."],
|
||||||
["48", "cart_line_item_id", "Store the line item's ID in the cart for later reference."],
|
["50", "is_addon", "Set `is_addon` flag for addon products."],
|
||||||
["63", "addToCartWorkflow", "Add complementary and addon products to the cart."],
|
["60", "cart_line_item_id", "Store the line item's ID in the cart for later reference."],
|
||||||
["72", "updateLineItemInCartWorkflow", "Update main product line item metadata with its cart line item ID."]
|
["75", "addToCartWorkflow", "Add complementary and addon products to the cart."],
|
||||||
|
["84", "updateLineItemInCartWorkflow", "Update main product line item metadata with its cart line item ID."]
|
||||||
]
|
]
|
||||||
|
|
||||||
```ts title="src/workflows/add-product-builder-to-cart.ts" highlights={addProductBuilderToCartWorkflowHighlights3}
|
```ts title="src/workflows/add-product-builder-to-cart.ts" highlights={addProductBuilderToCartWorkflowHighlights3}
|
||||||
|
// Step 4: Get cart after main product is added
|
||||||
|
const { data: cartWithMainProduct } = useQueryGraphStep({
|
||||||
|
entity: "cart",
|
||||||
|
fields: ["*", "items.*"],
|
||||||
|
filters: {
|
||||||
|
id: input.cart_id,
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
throwIfKeyNotFound: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Step 5: Add complementary and addon products
|
// Step 5: Add complementary and addon products
|
||||||
const {
|
const {
|
||||||
items_to_add: moreItemsToAdd,
|
items_to_add: moreItemsToAdd,
|
||||||
|
|||||||
@@ -6566,7 +6566,7 @@ export const generatedEditDates = {
|
|||||||
"app/commerce-modules/order/order-totals/page.mdx": "2025-07-31T15:12:10.633Z",
|
"app/commerce-modules/order/order-totals/page.mdx": "2025-07-31T15:12:10.633Z",
|
||||||
"app/commerce-modules/user/invite-user-subscriber/page.mdx": "2025-08-01T12:01:54.551Z",
|
"app/commerce-modules/user/invite-user-subscriber/page.mdx": "2025-08-01T12:01:54.551Z",
|
||||||
"app/how-to-tutorials/tutorials/invoice-generator/page.mdx": "2025-08-04T00:00:00.000Z",
|
"app/how-to-tutorials/tutorials/invoice-generator/page.mdx": "2025-08-04T00:00:00.000Z",
|
||||||
"app/how-to-tutorials/tutorials/product-builder/page.mdx": "2025-08-14T11:21:18.409Z",
|
"app/how-to-tutorials/tutorials/product-builder/page.mdx": "2025-09-01T14:59:43.128Z",
|
||||||
"app/integrations/guides/payload/page.mdx": "2025-08-21T05:24:11.537Z",
|
"app/integrations/guides/payload/page.mdx": "2025-08-21T05:24:11.537Z",
|
||||||
"references/js_sdk/admin/Client/methods/js_sdk.admin.Client.getToken/page.mdx": "2025-08-14T12:59:55.678Z",
|
"references/js_sdk/admin/Client/methods/js_sdk.admin.Client.getToken/page.mdx": "2025-08-14T12:59:55.678Z",
|
||||||
"app/commerce-modules/order/draft-orders/page.mdx": "2025-08-26T09:21:49.780Z",
|
"app/commerce-modules/order/draft-orders/page.mdx": "2025-08-26T09:21:49.780Z",
|
||||||
|
|||||||
Reference in new issue
Block a user