fix(promotion, core-flows): updating cart with removed promotion removes adjustments (#10489)

This commit is contained in:
Riqwan Thamir authored and GitHub committed 2024-12-08 13:13:31 +01:00
1 parent 864f53011b
commit f95c4e240c
5 files changed
+62 -76

No files matched your search

@@ -106,13 +106,16 @@ export const refreshCartItemsWorkflow = createWorkflow(
input: { cart_id: cart.id },
})
const cartPromoCodes = transform({ cart, input }, ({ cart, input }) => {
if (isDefined(input.promo_codes)) {
return input.promo_codes
} else {
return cart.promotions.map((p) => p.code)
const cartPromoCodes = transform(
{ refetchedCart, input },
({ refetchedCart, input }) => {
if (isDefined(input.promo_codes)) {
return input.promo_codes
} else {
return refetchedCart.promotions.map((p) => p?.code).filter(Boolean)
}
}
})
)
updateCartPromotionsWorkflow.runAsStep({
input: {