simplify product category handling
This commit is contained in:
@ -12,7 +12,7 @@ import {
|
|||||||
formatGqlForJSON,
|
formatGqlForJSON,
|
||||||
} from "./shopifyApi"
|
} from "./shopifyApi"
|
||||||
import * as shopify from 'shopify-admin-api-typings'
|
import * as shopify from 'shopify-admin-api-typings'
|
||||||
import { getCellRangeByColumnName, getRowByColumnValue } from "./sheetUtils"
|
import { getCellRangeByColumnName, getRowByColumnValue, vlookupByColumns } from "./sheetUtils"
|
||||||
import { Config } from "./config"
|
import { Config } from "./config"
|
||||||
|
|
||||||
|
|
||||||
@ -114,6 +114,10 @@ export class Product {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShopifyCategory(): string {
|
||||||
|
return vlookupByColumns("values", "product_type", this.category, "shopify_category")
|
||||||
|
}
|
||||||
|
|
||||||
ToShopifyProductSet() {
|
ToShopifyProductSet() {
|
||||||
let sps = new ShopifyProductSetInput()
|
let sps = new ShopifyProductSetInput()
|
||||||
//TODO: map category IDs
|
//TODO: map category IDs
|
||||||
@ -125,6 +129,7 @@ export class Product {
|
|||||||
sps.status = this.shopify_status
|
sps.status = this.shopify_status
|
||||||
}
|
}
|
||||||
sps.productType = this.product_type
|
sps.productType = this.product_type
|
||||||
|
sps.category = this.ShopifyCategory()
|
||||||
sps.tags = this.tags
|
sps.tags = this.tags
|
||||||
sps.title = this.title
|
sps.title = this.title
|
||||||
sps.descriptionHtml = this.description
|
sps.descriptionHtml = this.description
|
||||||
|
|||||||
Reference in New Issue
Block a user