diff --git a/packages/core/src/entity/order-item/order-item.entity.ts b/packages/core/src/entity/order-item/order-item.entity.ts index 729a6bcf28..ed42a204db 100644 --- a/packages/core/src/entity/order-item/order-item.entity.ts +++ b/packages/core/src/entity/order-item/order-item.entity.ts @@ -28,7 +28,7 @@ export class OrderItem extends VendureEntity { line: OrderLine; @EntityId() - lineId: ID; + lineId: ID; // TypeORM requires this ID field on the entity explicitly in order to save the foreign key via `.insert` /** * @description diff --git a/packages/core/src/service/helpers/order-modifier/order-modifier.ts b/packages/core/src/service/helpers/order-modifier/order-modifier.ts index f6122c94b4..211bbc53a5 100644 --- a/packages/core/src/service/helpers/order-modifier/order-modifier.ts +++ b/packages/core/src/service/helpers/order-modifier/order-modifier.ts @@ -158,7 +158,7 @@ export class OrderModifier { listPriceIncludesTax: orderLine.productVariant.priceIncludesTax, adjustments: [], taxLines: [], - line: orderLine, + lineId: orderLine.id, }), ); } diff --git a/packages/core/src/service/services/order.service.ts b/packages/core/src/service/services/order.service.ts index 79e76c2eb8..9fb702c2be 100644 --- a/packages/core/src/service/services/order.service.ts +++ b/packages/core/src/service/services/order.service.ts @@ -1328,7 +1328,13 @@ export class OrderService { promotions, updatedOrderLine ? [updatedOrderLine] : [], ); - // await this.connection.getRepository(ctx, OrderItem).save(updatedItems, { reload: false }); + const updateFields: Array = [ + 'initialListPrice', + 'listPrice', + 'listPriceIncludesTax', + 'adjustments', + 'taxLines', + ]; await this.connection .getRepository(ctx, OrderItem) .createQueryBuilder() @@ -1336,13 +1342,7 @@ export class OrderService { .values(updatedItems) .orUpdate({ conflict_target: ['id'], - overwrite: [ - 'initialListPrice', - 'listPrice', - 'listPriceIncludesTax', - 'adjustments', - 'taxLines', - ], + overwrite: updateFields, }) .updateEntity(false) .execute();