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

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

devAJBatista
Shopify Partner
2 0 0

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

 

 

 

Replies 3 (3)

SomeUsernameHe
Shopify Partner
515 57 109

Try:

measurement {
                  weight {
                    value
                    unit
                  }
                }
Have I helped? Consider putting coffee in my mouth!
Buy Me a Coffee
devAJBatista
Shopify Partner
2 0 0

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

MtnsDigital
Shopify Partner
1 0 0

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.