don't try to update if there is no SKU
This commit is contained in:
13
src/match.ts
13
src/match.ts
@ -1,5 +1,7 @@
|
||||
import { Shop } from "./shopifyApi"
|
||||
import { Product } from "./Product"
|
||||
import { toastAndLog } from "./sheetUtils"
|
||||
import { getCellRangeByColumnName } from "./sheetUtils"
|
||||
|
||||
export function matchProductToShopify(row: number) {
|
||||
console.log("row: " + row)
|
||||
@ -18,7 +20,14 @@ export function updateProductToShopify(row: number) {
|
||||
console.log(product)
|
||||
product.ImportFromInventory(row)
|
||||
console.log(product)
|
||||
product.MatchToShopifyProduct(shop)
|
||||
console.log(product)
|
||||
if (product.sku == "") {
|
||||
toastAndLog("No SKU defined for the product on row " + row + "!")
|
||||
let productInventorySheet =
|
||||
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("product_inventory")
|
||||
getCellRangeByColumnName(productInventorySheet, "shopify_id", row).setValue(
|
||||
""
|
||||
)
|
||||
return
|
||||
}
|
||||
product.UpdateShopifyProduct(shop)
|
||||
}
|
||||
Reference in New Issue
Block a user