Skip to content

Commit 350a79e

Browse files
committed
Review comments
1 parent 0af50ae commit 350a79e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/modules/order/src/utils/actions/item-update.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import {
22
ChangeActionType,
3+
isDefined,
34
MathBN,
45
MedusaError,
6+
mergeMetadata,
57
} from "@medusajs/framework/utils"
68
import { OrderChangeProcessing } from "../calculate-order-change"
79
import { setActionReference } from "../set-action-reference"
@@ -27,9 +29,15 @@ OrderChangeProcessing.registerActionType(ChangeActionType.ITEM_UPDATE, {
2729
existing.quantity = currentQuantity
2830
existing.detail.quantity = currentQuantity
2931

30-
if (action.details.metadata !== undefined) {
31-
existing.detail.metadata = action.details.metadata
32-
existing.metadata = action.details.metadata
32+
if (isDefined(action.details.metadata)) {
33+
existing.detail.metadata = mergeMetadata(
34+
existing.detail.metadata ?? {},
35+
action.details.metadata
36+
)
37+
existing.metadata = mergeMetadata(
38+
existing.metadata ?? {},
39+
action.details.metadata
40+
)
3341
}
3442

3543
if (action.details.adjustments) {

0 commit comments

Comments
 (0)