add compare_at_price support
This commit is contained in:
@ -43,27 +43,29 @@ export function columnOnEditHandler(e: GoogleAppsScript.Events.SheetsOnEdit) {
|
||||
for (let row = e.range.getRow(); row <= e.range.getLastRow(); row++) {
|
||||
console.log("row: " + row)
|
||||
let updateString = "updating " + header + " on row " + row
|
||||
toastAndLog(updateString)
|
||||
switch (header) {
|
||||
case "shopify_status":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "title":
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "category":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "product_type":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "tags":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "description":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
case "price":
|
||||
toastAndLog(updateString)
|
||||
updateProductToShopify(row)
|
||||
break
|
||||
default:
|
||||
|
||||
@ -25,6 +25,7 @@ export class Product {
|
||||
description: string = ""
|
||||
sku: string = ""
|
||||
price: number = 0
|
||||
compare_at_price: number = 0
|
||||
shipping: number = 0
|
||||
function: string = ""
|
||||
type: string = ""
|
||||
@ -119,6 +120,9 @@ export class Product {
|
||||
}
|
||||
variant.sku = this.sku
|
||||
variant.price = this.price
|
||||
if (this.compare_at_price > 0) {
|
||||
variant.compareAtPrice = this.compare_at_price
|
||||
}
|
||||
sps.variants.push(variant)
|
||||
console.log("ToShopifyProductSet:\n" + JSON.stringify(sps, null, 2))
|
||||
//TODO: add initial inventory
|
||||
|
||||
Reference in New Issue
Block a user