From fa700b622e59722ded8682f5de55aa20cadd147f Mon Sep 17 00:00:00 2001 From: Ben Miller Date: Sun, 17 Nov 2024 11:06:29 -0700 Subject: [PATCH] unset shopify properties if search fails --- src/OnEditHandler.ts | 4 ++++ src/Product.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/OnEditHandler.ts b/src/OnEditHandler.ts index 326b44b..80e25e4 100644 --- a/src/OnEditHandler.ts +++ b/src/OnEditHandler.ts @@ -68,6 +68,10 @@ export function columnOnEditHandler(e: GoogleAppsScript.Events.SheetsOnEdit) { toastAndLog(updateString) updateProductToShopify(row) break + case "compare_at_price": + toastAndLog(updateString) + updateProductToShopify(row) + break default: continue } diff --git a/src/Product.ts b/src/Product.ts index 708e0f1..61121f6 100644 --- a/src/Product.ts +++ b/src/Product.ts @@ -83,6 +83,12 @@ export class Product { let product = shop.GetProductBySku(this.sku) if (product == undefined || product.id == undefined || product.id == "") { 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 } this.shopify_product = product