diff --git a/packages/core/src/service/services/product-option-group.service.ts b/packages/core/src/service/services/product-option-group.service.ts index e411a5e815..5b7cea9b3a 100644 --- a/packages/core/src/service/services/product-option-group.service.ts +++ b/packages/core/src/service/services/product-option-group.service.ts @@ -133,6 +133,8 @@ export class ProductOptionGroupService { */ async deleteGroupAndOptionsFromProduct(ctx: RequestContext, id: ID, productId: ID) { const optionGroup = await this.connection.getEntityOrThrow(ctx, ProductOptionGroup, id, { + relationLoadStrategy: 'query', + loadEagerRelations: false, relations: ['options', 'product'], }); const deletedOptionGroup = new ProductOptionGroup(optionGroup); @@ -165,6 +167,8 @@ export class ProductOptionGroupService { // hard delete const product = await this.connection.getRepository(ctx, Product).findOne({ + relationLoadStrategy: 'query', + loadEagerRelations: false, where: { id: productId }, relations: ['optionGroups'], }); diff --git a/packages/core/src/service/services/product.service.ts b/packages/core/src/service/services/product.service.ts index 6ab0c1d96c..40c9510c07 100644 --- a/packages/core/src/service/services/product.service.ts +++ b/packages/core/src/service/services/product.service.ts @@ -271,6 +271,8 @@ export class ProductService { async softDelete(ctx: RequestContext, productId: ID): Promise { const product = await this.connection.getEntityOrThrow(ctx, Product, productId, { + relationLoadStrategy: 'query', + loadEagerRelations: false, channelId: ctx.channelId, relations: ['variants', 'optionGroups'], }); @@ -449,6 +451,8 @@ export class ProductService { private async getProductWithOptionGroups(ctx: RequestContext, productId: ID): Promise { const product = await this.connection.getRepository(ctx, Product).findOne({ + relationLoadStrategy: 'query', + loadEagerRelations: false, where: { id: productId, deletedAt: IsNull() }, relations: ['optionGroups', 'variants', 'variants.options'], });