diff --git a/src/OnEditHandler.ts b/src/OnEditHandler.ts index 1dc03d0..3d9e932 100644 --- a/src/OnEditHandler.ts +++ b/src/OnEditHandler.ts @@ -43,37 +43,24 @@ 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 - switch (header) { - case "shopify_status": - toastAndLog(updateString) - updateProductToShopify(row) - break - case "title": - 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 - case "compare_at_price": - toastAndLog(updateString) - updateProductToShopify(row) - break - default: - continue + let shopifyUpdateColumns = [ + "shopify_status", + "title", + "product_type", + "tags", + "description", + "base_price", + "original_price", + "weight_grams", + "product_height_cm", + "product_width_cm", + "product_depth_cm" + ] + if (shopifyUpdateColumns.includes(header)) { + // Accumulate changes for 30s before updating + toastAndLog(updateString) + updateProductToShopify(row) + break } toastAndLog("completed " + updateString) }