@haus-tech/product-import-export-plugin 3.0.14 → 3.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,7 +47,7 @@ export interface ParsedAsset {
47
47
  */
48
48
  export interface ParsedProductVariant {
49
49
  sku: string;
50
- price: number;
50
+ price: number | undefined;
51
51
  taxCategory: string;
52
52
  stockOnHand: number;
53
53
  trackInventory: GlobalFlag;
@@ -374,7 +374,7 @@ let ImportParser = class ImportParser {
374
374
  const jsonAssets = parseAssetsIfJson(r.variantAssets);
375
375
  const parsedVariant = {
376
376
  sku: parseString(r.sku),
377
- price: parseNumber(r.price),
377
+ price: r.price ? parseNumber(r.price) : undefined,
378
378
  taxCategory: parseString(r.taxCategory),
379
379
  stockOnHand: parseNumber(r.stockOnHand),
380
380
  trackInventory: r.trackInventory == null || r.trackInventory === ''
@@ -475,7 +475,7 @@ let ProductImporter = class ProductImporter {
475
475
  customFields: await this.processCustomFieldValues(translation.customFields, this.configService.customFields.ProductVariant, ctx),
476
476
  };
477
477
  })),
478
- price: Math.round(variant.price * 100),
478
+ price: (0, lodash_1.isUndefined)(variant.price) ? undefined : Math.round(variant.price * 100),
479
479
  customFields: variantCustomFields,
480
480
  };
481
481
  const createdVariantId = existingVariant
@@ -349,9 +349,6 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
349
349
  if (!input.optionIds) {
350
350
  input.optionIds = [];
351
351
  }
352
- if (input.price == null) {
353
- input.price = 0;
354
- }
355
352
  const inputWithoutPrice = {
356
353
  ...input,
357
354
  };
@@ -409,7 +406,7 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
409
406
  p.currencyCode === this.importCtx.channel.defaultCurrencyCode);
410
407
  if (!existingVariantPrice) {
411
408
  const variantPrice = new core_1.ProductVariantPrice({
412
- price: input.price,
409
+ price: (0, lodash_1.isNumber)(input.price) ? input.price : 0,
413
410
  channelId,
414
411
  currencyCode: this.importCtx.channel.defaultCurrencyCode,
415
412
  });
@@ -419,6 +416,9 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
419
416
  .save(variantPrice, { reload: false });
420
417
  }
421
418
  else {
419
+ if ((0, lodash_1.isUndefined)(input.price)) {
420
+ input.price = existingVariantPrice.price;
421
+ }
422
422
  existingVariantPrice.price = input.price;
423
423
  await this.connection.rawConnection
424
424
  .getRepository(core_1.ProductVariantPrice)
@@ -474,7 +474,7 @@ let ExtendedFastImporterService = class ExtendedFastImporterService {
474
474
  const assignedChannelIds = (0, unique_1.unique)([this.defaultChannel, this.importCtx.channel], 'id').map((c) => c.id);
475
475
  for (const channelId of assignedChannelIds) {
476
476
  const variantPrice = new core_1.ProductVariantPrice({
477
- price: input.price,
477
+ price: (0, lodash_1.isNumber)(input.price) ? input.price : 0,
478
478
  channelId,
479
479
  currencyCode: this.importCtx.channel.defaultCurrencyCode,
480
480
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/product-import-export-plugin",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "description": "A Vendure plugin for importing and exporting products using a CSV file",
5
5
  "author": "Haus Tech",
6
6
  "repository": {