A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am having an issue with a product query. Is returning: Field 'measurement' doesn't exist on type 'InventoryItem'
Any idea why?
This is my product query:
products(first: 10) {
edges {
node {
id
title
productType
tags
vendor
images (first: 5) {
edges {
node {
url
}
}
}
variants(first: 100) {
edges {
node {
id
title
image {
url
}
inventoryItem {
id
countryCodeOfOrigin
harmonizedSystemCode
measurement {
value
unit
}
}
sku
barcode
weight
weightUnit
price
requiresShipping
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
Try:
measurement {
weight {
value
unit
}
}
Actually I end up removing it! I'm on version 2023-10, which this field is not supported, so I had to rely on variant weight and weigthUnit fields. Thanks
How were you making your API call? If you're executing from an extension (e.g. Admin Action or App Block) and using the default URL, it's unclear exactly which API version you'll use. It doesn't seem to read from your .toml file OR the partner dashboard setting.
fetch("shopify:admin/api/graphql.json" ...)
you'll need to update it to include the version number, e.g.
fetch("shopify:admin/api/2024-07/graphql.json"...)
You won't be able to remain on 2023-10 using the old fields indefinitely.