actually working dimension fields!

This commit is contained in:
Ben Miller
2025-08-03 02:08:09 -06:00
parent f738390d76
commit 17e0c1b707
2 changed files with 42 additions and 26 deletions

View File

@ -671,6 +671,43 @@ export class Shop {
return newItem
}
SetInventoryItemWeight(item: shopify.InventoryItem, config: Config, weight: number, weight_unit: shopify.WeightUnit) {
let gql = /* GraphQL */ `
mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {
inventoryItemUpdate(id: $id, input: $input) {
inventoryItem {
id
measurement {
weight {
value
unit
}
}
}
userErrors {
field
message
}
}
}
`
let variables = {
id: item.id,
input: {
measurement: {
weight: {
value: weight,
unit: weight_unit
}
}
},
}
let query = buildGqlQuery(gql, variables)
let response = this.shopifyGraphQLAPI(query)
let newItem: shopify.InventoryItem = response.content
return newItem
}
shopifyAPI(endpoint: string, query: {}, next = "") {
var options: GoogleAppsScript.URL_Fetch.URLFetchRequestOptions = {
method: "get",