unset shopify properties if search fails

This commit is contained in:
Ben Miller
2024-11-17 11:06:29 -07:00
parent dc97a0001a
commit fa700b622e
2 changed files with 10 additions and 0 deletions

View File

@ -68,6 +68,10 @@ export function columnOnEditHandler(e: GoogleAppsScript.Events.SheetsOnEdit) {
toastAndLog(updateString) toastAndLog(updateString)
updateProductToShopify(row) updateProductToShopify(row)
break break
case "compare_at_price":
toastAndLog(updateString)
updateProductToShopify(row)
break
default: default:
continue continue
} }

View File

@ -83,6 +83,12 @@ export class Product {
let product = shop.GetProductBySku(this.sku) let product = shop.GetProductBySku(this.sku)
if (product == undefined || product.id == undefined || product.id == "") { if (product == undefined || product.id == undefined || product.id == "") {
console.log("MatchToShopifyProduct: no product matched") console.log("MatchToShopifyProduct: no product matched")
this.shopify_id = ""
this.shopify_product = {} as shopify.Product
this.shopify_default_variant_id = ""
this.shopify_default_option_id = ""
this.shopify_default_option_value_id = ""
this.shopify_status = ""
return return
} }
this.shopify_product = product this.shopify_product = product