combine metafields update
This commit is contained in:
@ -11,11 +11,14 @@ import {
|
||||
VariantOptionValueInput,
|
||||
formatGqlForJSON,
|
||||
} from "./shopifyApi"
|
||||
import * as shopify from 'shopify-admin-api-typings'
|
||||
import { getCellRangeByColumnName, getRowByColumnValue, vlookupByColumns } from "./sheetUtils"
|
||||
import * as shopify from "shopify-admin-api-typings"
|
||||
import {
|
||||
getCellRangeByColumnName,
|
||||
getRowByColumnValue,
|
||||
vlookupByColumns,
|
||||
} from "./sheetUtils"
|
||||
import { Config } from "./config"
|
||||
|
||||
|
||||
export class Product {
|
||||
shopify_id: string = ""
|
||||
title: string = ""
|
||||
@ -116,11 +119,21 @@ export class Product {
|
||||
}
|
||||
|
||||
ShopifyCategory(): string {
|
||||
return vlookupByColumns("values", "product_type", this.product_type, "shopify_category")
|
||||
return vlookupByColumns(
|
||||
"values",
|
||||
"product_type",
|
||||
this.product_type,
|
||||
"shopify_category"
|
||||
)
|
||||
}
|
||||
|
||||
EbayCategory(): string {
|
||||
return vlookupByColumns("values", "product_type", this.product_type, "ebay_category_id")
|
||||
return vlookupByColumns(
|
||||
"values",
|
||||
"product_type",
|
||||
this.product_type,
|
||||
"ebay_category_id"
|
||||
)
|
||||
}
|
||||
|
||||
ToShopifyProductSet() {
|
||||
@ -191,7 +204,12 @@ export class Product {
|
||||
shop.SetInventoryItemDefaults(item, config)
|
||||
if (this.weight_grams > 0) {
|
||||
console.log("UpdateShopifyProduct: setting weight on inventory item")
|
||||
shop.SetInventoryItemWeight(item, config, this.weight_grams, shopify.WeightUnit.GRAMS)
|
||||
shop.SetInventoryItemWeight(
|
||||
item,
|
||||
config,
|
||||
this.weight_grams,
|
||||
shopify.WeightUnit.GRAMS
|
||||
)
|
||||
}
|
||||
if (newProduct) {
|
||||
console.log("UpdateShopifyProduct: setting defaults on new product")
|
||||
@ -199,9 +217,8 @@ export class Product {
|
||||
shop.UpdateInventoryItemQuantity(item, 1, config)
|
||||
console.log(JSON.stringify(response, null, 2))
|
||||
}
|
||||
// update dimension metafields
|
||||
this.UpdateDimensionMetafields(shop)
|
||||
this.UpdateEbayCategoryMetafield(shop)
|
||||
// update all metafields
|
||||
this.UpdateAllMetafields(shop)
|
||||
}
|
||||
|
||||
UpdateEbayCategoryMetafield(shop: Shop) {
|
||||
|
||||
Reference in New Issue
Block a user