partial implementation of product update
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
// prettier-ignore
|
||||
import { Shop, ShopifyProduct, ShopifyProductsQuery, ShopifyProductsResponse } from "./shopifyApi"
|
||||
import { Shop, ShopifyProduct, ShopifyProductsQuery, ShopifyProductsResponse, ShopifyProductSetInput, ShopifyProductVariant } from "./shopifyApi"
|
||||
import { getCellRangeByColumnName, getRowByColumnValue } from "./sheetUtils"
|
||||
|
||||
|
||||
@ -87,4 +87,27 @@ export class Product {
|
||||
this.shopify_id
|
||||
)
|
||||
}
|
||||
|
||||
ToShopifyProductSet() {
|
||||
let sps = new ShopifyProductSetInput()
|
||||
sps.category = this.category
|
||||
sps.id = this.shopify_id
|
||||
sps.productType = this.product_type
|
||||
sps.tags = this.tags
|
||||
sps.title = this.title
|
||||
sps.descriptionHtml = this.description
|
||||
sps.variants = []
|
||||
let variant = new ShopifyProductVariant()
|
||||
variant.id = 1
|
||||
variant.sku = this.sku
|
||||
variant.price = this.price
|
||||
variant.weight = this.weight_grams
|
||||
sps.variants.push(variant)
|
||||
return sps
|
||||
}
|
||||
|
||||
UpdateShopifyProduct(shop: Shop) {
|
||||
let sps = this.ToShopifyProductSet()
|
||||
console.log("sps: " + JSON.stringify(sps))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user