simplify product category handling

This commit is contained in:
Ben Miller
2025-08-10 13:43:54 -06:00
parent 62514fa20e
commit 6d75973835

View File

@ -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