From bfd63cfc02e5cdc4eb3816ff031caa0f975b10a0 Mon Sep 17 00:00:00 2001 From: fPolic Date: Thu, 7 Nov 2024 10:45:41 +0100 Subject: [PATCH 1/2] fix: pass metadata on order fulfillment create --- .../core/core-flows/src/order/workflows/create-fulfillment.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/core-flows/src/order/workflows/create-fulfillment.ts b/packages/core/core-flows/src/order/workflows/create-fulfillment.ts index 1f81b18e7bfad..4f922dcbe9374 100644 --- a/packages/core/core-flows/src/order/workflows/create-fulfillment.ts +++ b/packages/core/core-flows/src/order/workflows/create-fulfillment.ts @@ -160,6 +160,7 @@ function prepareFulfillmentData({ labels: input.labels ?? [], delivery_address: shippingAddress as any, packed_at: new Date(), + metadata: input.metadata, }, } } From 7b7559d40d89df4ef206e2952b061f530f3f4ef8 Mon Sep 17 00:00:00 2001 From: fPolic Date: Thu, 7 Nov 2024 10:59:23 +0100 Subject: [PATCH 2/2] fix: test metadata persistence --- .../__tests__/order/workflows/create-fulfillment.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts index baa91169b3a53..0a94876ccfe13 100644 --- a/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts +++ b/integration-tests/modules/__tests__/order/workflows/create-fulfillment.spec.ts @@ -372,6 +372,7 @@ medusaIntegrationTestRunner({ ], no_notification: false, location_id: undefined, + metadata: { meta_key: "meta_value" }, } await createOrderFulfillmentWorkflow(container).run({ @@ -406,6 +407,9 @@ medusaIntegrationTestRunner({ expect(orderFulfillItemWithInventory.detail.fulfilled_quantity).toEqual( 1 ) + expect(orderFulfill.fulfillments[0].metadata).toEqual({ + meta_key: "meta_value", + }) const reservation = await inventoryModule.listReservationItems({ line_item_id: itemWithInventory.id,