Field 'measurement' doesn't exist on type 'InventoryItem'

Topic summary

A developer encountered an error stating that the ‘measurement’ field doesn’t exist on the InventoryItem type when querying product data.

Root Cause:
The issue stems from using API version 2023-10, where the ‘measurement’ field is no longer supported on InventoryItem.

Solution:
The developer resolved this by removing the ‘measurement’ field from their query and instead relying on the variant’s ‘weight’ and ‘weightUnit’ fields, which remain available in this API version.

Additional Context:
Another participant noted that when making API calls from extensions (Admin Actions, App Blocks), the API version may not default to settings in .toml files or partner dashboard. They recommend explicitly specifying the version number in the fetch URL (e.g., fetch("shopify:admin/api/2024-07/graphql.json")) rather than using the default URL to ensure consistent behavior and avoid relying on deprecated fields.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

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.