Browse Source

fix(core): Fix error when assigning deleted ProductVariant to channel

Michael Bromley 4 years ago
parent
commit
b5d0e4319a
1 changed files with 3 additions and 0 deletions
  1. 3 0
      packages/core/src/service/services/product-variant.service.ts

+ 3 - 0
packages/core/src/service/services/product-variant.service.ts

@@ -603,6 +603,9 @@ export class ProductVariantService {
             .findByIds(input.productVariantIds, { relations: ['taxCategory', 'assets'] });
         const priceFactor = input.priceFactor != null ? input.priceFactor : 1;
         for (const variant of variants) {
+            if (variant.deletedAt) {
+                continue;
+            }
             await this.applyChannelPriceAndTax(variant, ctx);
             await this.channelService.assignToChannels(ctx, Product, variant.productId, [input.channelId]);
             await this.channelService.assignToChannels(ctx, ProductVariant, variant.id, [input.channelId]);