I use productVariantUpdate to update variants price and compare-at price.
It works well but it is not efficient as it only allows one update per call.
mutation productVariantUpdate($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
productVariant {
id
title
inventoryPolicy
inventoryQuantity
price
compareAtPrice
}
userErrors {
field
message
}
}
}
{
"input": {
"id": "gid://shopify/ProductVariant/43729076",
"price": 9.99,
"compareAtPrice": 14.99
}
}
For example I use inventoryBulkAdjustQuantityAtLocation to update my stock and it is amazing.
I update 50 in one go and enjoy extremly fast updates with fewer API calls.
mutation BulkInventory($invItemAdjustments: [InventoryAdjustItemInput!]!, $locationId: ID!) {
inventoryBulkAdjustQuantityAtLocation(inventoryItemAdjustments: $invItemAdjustments, locationId: $locationId) {
inventoryLevels {
id
available
item {
id
sku
}
location {
id
name
}
}
userErrors {
field
message
}
}
}
{
"invItemAdjustments":[
{
"inventoryItemId":"gid://shopify/InventoryItem/43028674117838",
"availableDelta":16
},
{
"inventoryItemId":"gid://shopify/InventoryItem/43028674150606",
"availableDelta":3
},
{
"inventoryItemId":"gid://shopify/InventoryItem/43028674183374",
"availableDelta":2
},
{
"inventoryItemId":"gid://shopify/InventoryItem/43028676018382",
"availableDelta":10
}
],
"locationId":"gid://shopify/Location/62241177806"
}
Any way to adapt this?