GraphQL Admin API productVariantsBulkUpdate (mutation) not allow to update inventoryQuantity

Topic summary

A developer is encountering an error when attempting to update inventory quantities for multiple product variants using the productVariantsBulkUpdate GraphQL mutation.

Error Message:

  • “Inventory quantities can only be provided during create. To update inventory for existing variants, use inventoryAdjustQuantities.”

Current Approach:

  • Using productVariantsBulkUpdate mutation with inventoryQuantities field
  • Attempting to update availableQuantity for existing variants at a specific location

Issue:

  • The mutation does not support updating inventory quantities for existing variants
  • The error explicitly directs to use inventoryAdjustQuantities instead

Status:

  • The question remains unanswered with no resolution or alternative solution provided yet
Summarized with AI on November 1. AI used: claude-sonnet-4-5-20250929.

We are trying to update multiple variants inventoryQuantity for single product but it is showing error :

{
field: [ ‘variants’, ‘0’, ‘inventoryQuantities’ ],
message: ‘Inventory quantities can only be provided during create. To update inventory for existing variants, use inventoryAdjustQuantities.’

}

Our script is below

// GraphQL mutation for bulk updating variants
const BULK_UPDATE_VARIANTS = gqlmutation productVariantsBulkUpdate($productId: ID!,$variants: [ProductVariantsBulkInput!]!) { productVariantsBulkUpdate(productId: $productId, variants: $variants) { product { id variants(first: 10) { edges { node { id inventoryQuantity } } } } userErrors { field message } } };

async function updateVariantQuantities() {
try {
// Example variants to update - replace with your actual variant IDs and quantities
const productId = “gid://shopify/Product/7128034803775”;
const variants = [
{
id: “gid://shopify/ProductVariant/40003114434623”,
inventoryQuantities: {
availableQuantity: 10,
locationId: “gid://shopify/Location/36532813887”
}
},
{
id: “gid://shopify/ProductVariant/40012127830079”,
inventoryQuantities: {
availableQuantity: 15,
locationId: “gid://shopify/Location/36532813887”
}
}
];

1 Like