diff --git a/www/apps/book/public/llms-full.txt b/www/apps/book/public/llms-full.txt index 7d4f374324..333caa67ad 100644 --- a/www/apps/book/public/llms-full.txt +++ b/www/apps/book/public/llms-full.txt @@ -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: ```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 const { items_to_add: moreItemsToAdd, diff --git a/www/apps/resources/app/how-to-tutorials/tutorials/product-builder/page.mdx b/www/apps/resources/app/how-to-tutorials/tutorials/product-builder/page.mdx index 36c2aca7ef..37669d225b 100644 --- a/www/apps/resources/app/how-to-tutorials/tutorials/product-builder/page.mdx +++ b/www/apps/resources/app/how-to-tutorials/tutorials/product-builder/page.mdx @@ -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: export const addProductBuilderToCartWorkflowHighlights3 = [ - ["3", "items_to_add", "Complementary and addon items to add to the cart."], - ["4", "main_item_update", "Update main product line item metadata."], - ["30", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."], - ["37", "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."], - ["48", "cart_line_item_id", "Store the line item's ID in the cart for later reference."], - ["63", "addToCartWorkflow", "Add complementary and addon products to the cart."], - ["72", "updateLineItemInCartWorkflow", "Update main product line item metadata with its cart line item ID."] + ["2", "cartWithMainProduct", "Refetch the cart with the main product added."], + ["15", "items_to_add", "Complementary and addon items to add to the cart."], + ["16", "main_item_update", "Update main product line item metadata."], + ["42", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."], + ["49", "main_product_line_item_id", "Store the ID of the main item in the `metadata`."], + ["50", "is_addon", "Set `is_addon` flag for addon products."], + ["60", "cart_line_item_id", "Store the line item's ID in the cart for later reference."], + ["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} +// 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 const { items_to_add: moreItemsToAdd, diff --git a/www/apps/resources/generated/edit-dates.mjs b/www/apps/resources/generated/edit-dates.mjs index 52079ef0d4..6d634b107c 100644 --- a/www/apps/resources/generated/edit-dates.mjs +++ b/www/apps/resources/generated/edit-dates.mjs @@ -6566,7 +6566,7 @@ export const generatedEditDates = { "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/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", "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",