Field 'inventoryQuantities' doesn't exist on type 'ProductVariant' - GraphQL ProductUpdate

My Goal is to update Location Inventory per Product. I must use the productUpdate mutation as I want to eventually use it with the Bulk Operation Mutation.

I am doing a test with the GraphiQL utilizing the productUpdate mutation on only one product for testing.

It appears as though the documentation is incorrect or I am clearly doing something incorrectly because I get the error:

Field ‘inventoryQuantities’ doesn’t exist on type ‘ProductVariant’

Following the docs for the productUpdate on productInput.Variants here: https://shopify.dev/api/admin-graphql/2022-07/mutations/productupdate#field-productinput-variants

I see it clearly exists, so I am confused as to why this is happening.

mutation productUpdate($input: ProductInput!) {
  productUpdate(input: $input) {
    product {
     id
      variants(first: 3){
        edges {
          node {
            inventoryQuantities{
              availableQuantity,
              locationId
            }
          }
        }
      }
    }
    userErrors {
      field
      message
    }
  }
}

Query Variables:

{
  "input": {
    "id": "gid://shopify/Product/6691503472711",
    "variants": [
      {
        "inventoryQuantities":
        {
          "availableQuantity": 3000,
          "locationId": "gid://shopify/Location/61156032583"
        }
      }  
    ]
  }
}

It does not exist on an update mutation. Only exists on a create mutation, hence why you are getting that message. A little confusing, but that is the way it is.

1 Like