Skip to content

Commit

Permalink
fix(core-flows): Refresh cart when items are deleted (#10513)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivermrbl authored Dec 9, 2024
1 parent c9a66b1 commit e5e5a34
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -18,10 +13,8 @@ export const deleteLineItemsWorkflow = createWorkflow(
(input: WorkflowData<DeleteLineItemsWorkflowInput>) => {
deleteLineItemsStep(input.ids)

updateCartPromotionsWorkflow.runAsStep({
input: {
cart_id: input.cart_id,
},
refreshCartItemsWorkflow.runAsStep({
input: { cart_id: input.cart_id },
})
}
)

0 comments on commit e5e5a34

Please sign in to comment.