From e5e5a34108e30f8a029def88b1439b84013edebc Mon Sep 17 00:00:00 2001 From: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Date: Mon, 9 Dec 2024 19:21:32 +0100 Subject: [PATCH] fix(core-flows): Refresh cart when items are deleted (#10513) --- .../src/line-item/workflows/delete-line-items.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/core/core-flows/src/line-item/workflows/delete-line-items.ts b/packages/core/core-flows/src/line-item/workflows/delete-line-items.ts index 712a6f9890f20..d20d36dfaa99a 100644 --- a/packages/core/core-flows/src/line-item/workflows/delete-line-items.ts +++ b/packages/core/core-flows/src/line-item/workflows/delete-line-items.ts @@ -1,14 +1,9 @@ import { WorkflowData, createWorkflow } from "@medusajs/framework/workflows-sdk" -import { updateCartPromotionsWorkflow } from "../../cart/workflows/update-cart-promotions" +import { refreshCartItemsWorkflow } from "../../cart/workflows/refresh-cart-items" import { deleteLineItemsStep } from "../steps/delete-line-items" export type DeleteLineItemsWorkflowInput = { cart_id: string; ids: string[] } -// TODO: The DeleteLineItemsWorkflow are missing the following steps: -// - Refresh/delete shipping methods (fulfillment module) -// - Refresh line item adjustments (promotion module) -// - Update payment sessions (payment module) - export const deleteLineItemsWorkflowId = "delete-line-items" /** * This workflow deletes line items from a cart. @@ -18,10 +13,8 @@ export const deleteLineItemsWorkflow = createWorkflow( (input: WorkflowData) => { deleteLineItemsStep(input.ids) - updateCartPromotionsWorkflow.runAsStep({ - input: { - cart_id: input.cart_id, - }, + refreshCartItemsWorkflow.runAsStep({ + input: { cart_id: input.cart_id }, }) } )