fix(core-flows): update cart promotion data usage (#9456)
**What** The nullish coalescing can't really work since we are using proxies under the hood which is present
This commit is contained in:
committed by
GitHub
parent
00a51b59b1
commit
5a573928c4
@@ -1,8 +1,9 @@
|
||||
import { PromotionActions } from "@medusajs/framework/utils"
|
||||
import {
|
||||
WorkflowData,
|
||||
createWorkflow,
|
||||
parallelize,
|
||||
transform,
|
||||
WorkflowData,
|
||||
} from "@medusajs/framework/workflows-sdk"
|
||||
import { useRemoteQueryStep } from "../../common"
|
||||
import {
|
||||
@@ -42,10 +43,18 @@ export const updateCartPromotionsWorkflow = createWorkflow(
|
||||
list: false,
|
||||
})
|
||||
|
||||
const promo_codes = transform({ input }, (data) => {
|
||||
return (data.input.promo_codes || []) as string[]
|
||||
})
|
||||
|
||||
const action = transform({ input }, (data) => {
|
||||
return data.input.action || PromotionActions.ADD
|
||||
})
|
||||
|
||||
const promotionCodesToApply = getPromotionCodesToApply({
|
||||
cart: cart,
|
||||
promo_codes: input.promo_codes ?? [],
|
||||
action: input.action || PromotionActions.ADD,
|
||||
promo_codes,
|
||||
action: action as PromotionActions,
|
||||
})
|
||||
|
||||
const actions = getActionsToComputeFromPromotionsStep({
|
||||
|
||||
Reference in New Issue
Block a user