fix(core-flows): Refresh cart when items are deleted (#10513)
This commit is contained in:
@@ -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<DeleteLineItemsWorkflowInput>) => {
|
||||
deleteLineItemsStep(input.ids)
|
||||
|
||||
updateCartPromotionsWorkflow.runAsStep({
|
||||
input: {
|
||||
cart_id: input.cart_id,
|
||||
},
|
||||
refreshCartItemsWorkflow.runAsStep({
|
||||
input: { cart_id: input.cart_id },
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user