From d4ec842b4cc460152e0421b7ba31d289ff4cb468 Mon Sep 17 00:00:00 2001 From: Alessio Marano <46132382+Swampy469@users.noreply.github.com> Date: Fri, 5 Apr 2024 08:55:04 +0200 Subject: [PATCH] fix(core): Fix missing shipping lines in partial order (#2766) --- .../src/service/helpers/order-splitter/order-splitter.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/service/helpers/order-splitter/order-splitter.ts b/packages/core/src/service/helpers/order-splitter/order-splitter.ts index 31b09ca41e..6f2a9093d5 100644 --- a/packages/core/src/service/helpers/order-splitter/order-splitter.ts +++ b/packages/core/src/service/helpers/order-splitter/order-splitter.ts @@ -39,7 +39,13 @@ export class OrderSplitter { } const shippingLines: ShippingLine[] = []; for (const shippingLine of partialOrder.shippingLines) { - shippingLines.push(await this.duplicateShippingLine(ctx, shippingLine)); + const newShippingLine = await this.duplicateShippingLine(ctx, shippingLine); + lines.map((line) => { + if(shippingLine.id === line.shippingLineId) { + line.shippingLineId = newShippingLine.id; + } + }) + shippingLines.push(newShippingLine); } const sellerOrder = await this.connection.getRepository(ctx, Order).save( new Order({