partial implementation of product update

This commit is contained in:
Ben Miller
2024-11-14 02:03:42 -07:00
parent 9b01d6de8a
commit 220ee45e22
5 changed files with 103 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { getShopifyProducts, runShopifyOrders } from "./shopifyApi"
import { fillProductFromTemplate } from "./fillProductFromTemplate"
import { createMissingPhotoFolders } from "./createMissingPhotoFolders"
import { matchProductToShopify } from "./match"
import { matchProductToShopify, updateProductToShopify } from "./match"
import { reinstallTriggers } from "./triggers"
export function initMenu() {
@ -12,6 +12,7 @@ export function initMenu() {
.createMenu("This row...")
.addItem("Fill out product from template", fillProductFromTemplate.name)
.addItem("Match product to Shopify", matchProductToShopifyHandler.name)
.addItem("Update Shopify Product", updateShopifyProductHandler.name)
)
.addSeparator()
.addSubMenu(
@ -41,6 +42,16 @@ export function matchProductToShopifyHandler() {
matchProductToShopify(row)
}
export function updateShopifyProductHandler() {
var sheet = SpreadsheetApp.getActive().getActiveSheet()
if (sheet.getName() !== "product_inventory") {
console.log("skipping edit on sheet " + sheet.getName())
return
}
let row = SpreadsheetApp.getCurrentCell().getRow()
updateProductToShopify(row)
}
export function reauthorizeScript() {
ScriptApp.invalidateAuth()
}