I have a GraphQL query (version 2023-04) that requests product data including the weight field for variations. This has been working fine against multiple stores for a long time. However, there’s now one store where the query fails with this error;
“Field ‘weight’ doesn’t exist on type ‘ProductVariant’”
How can it be that the field is available on some stores and not others? It’s the same query and same API version.
The query is;
query ($id: ID!,$limit: Int!) {
product(id: $id) {
id
title
handle
status
totalInventory
tracksInventory
totalVariants
onlineStoreUrl
featuredImage {
id
url
altText
}
images(first: 10) {
nodes {
id
url
altText
}
}
variants(first:$limit) {
edges {
node {
weight
id
title
sku
barcode
price
compareAtPrice
}
}
}
}
}
This is because 2023-04
API has now been deprecated, you will automatically get moved to the oldest supported version. Where weight has moved to inventory item from a product variant.
It would be recommended that you keep up to date with the API Versions as you are 2 years out of date.
You can see it here productVariant - GraphQL Admin
Click on show fields and you’ll see weight under measurement.
1 Like
How does this explain that it’s working for all stores except one? Are different stores on different minimum API versions?
It’s likely you are just getting lucky on those stores. You will need to upgrade, so I’d just do the upgrade 
I’ve done some testing and this is definitely what’s happening. For others who stumble upon this and want to see what’s going on; check the value for the response header; x-shopify-api-version. In my case different versions of the API where used for different stores.
I’ve updated the API version we’re using when we call and fortunately didn’t need to make too many changes to the GraphQL queries.
Thanks @JordanFinners for pointing me in the right direction.