Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

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

stats_marketing
Shopify Partner
25 3 9

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 Expert
4843 60 546

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 Expert
4843 60 546

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