From 6d75973835bb0e7d9346b4b3079aa14f008505c7 Mon Sep 17 00:00:00 2001 From: Ben Miller Date: Sun, 10 Aug 2025 13:43:54 -0600 Subject: [PATCH] simplify product category handling --- src/Product.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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