diff --git a/src/Product.ts b/src/Product.ts index 4ff506e..5df6370 100644 --- a/src/Product.ts +++ b/src/Product.ts @@ -115,13 +115,11 @@ export class Product { } ShopifyCategory(): string { - return vlookupByColumns("values", "product_type", this.category, "shopify_category") + return vlookupByColumns("values", "product_type", this.product_type, "shopify_category") } ToShopifyProductSet() { let sps = new ShopifyProductSetInput() - //TODO: map category IDs - //sps.category = this.category if (this.shopify_id != "") { sps.id = this.shopify_id } @@ -129,7 +127,10 @@ export class Product { sps.status = this.shopify_status } sps.productType = this.product_type - sps.category = this.ShopifyCategory() + let category = this.ShopifyCategory() + if (category !== "") { + sps.category = this.ShopifyCategory() + } sps.tags = this.tags sps.title = this.title sps.descriptionHtml = this.description