diff --git a/src/Product.ts b/src/Product.ts index 7acc6f7..4ff506e 100644 --- a/src/Product.ts +++ b/src/Product.ts @@ -12,7 +12,7 @@ import { formatGqlForJSON, } from "./shopifyApi" import * as shopify from 'shopify-admin-api-typings' -import { getCellRangeByColumnName, getRowByColumnValue } from "./sheetUtils" +import { getCellRangeByColumnName, getRowByColumnValue, vlookupByColumns } from "./sheetUtils" import { Config } from "./config" @@ -114,6 +114,10 @@ export class Product { ) } + ShopifyCategory(): string { + return vlookupByColumns("values", "product_type", this.category, "shopify_category") + } + ToShopifyProductSet() { let sps = new ShopifyProductSetInput() //TODO: map category IDs @@ -125,6 +129,7 @@ export class Product { sps.status = this.shopify_status } sps.productType = this.product_type + sps.category = this.ShopifyCategory() sps.tags = this.tags sps.title = this.title sps.descriptionHtml = this.description