fix(promotion, core-flows): updating cart with removed promotion removes adjustments (#10489)
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user