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

Solved

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

stats_marketing
Shopify Partner
26 3 13

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"
        }
      }  
    ]
  }
}

 

 

 

Accepted Solution (1)

HunkyBill
Shopify Partner
4853 60 562

This is an accepted solution.

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.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com

View solution in original post

Reply 1 (1)

HunkyBill
Shopify Partner
4853 60 562

This is an accepted solution.

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.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com