Retrieving Variant Weight Data via GraphQL Admin API

Topic summary

Main issue: GraphQL Admin API returns “Field ‘weight’ doesn’t exist on type ‘ProductVariant’” when querying variant weight.

Version impact:

  • Error reproduced on API versions 2024-07 and 2024-10.
  • Works on 2024-04, where weight/weightUnit can still be queried on ProductVariant.

Current understanding:

  • In newer versions, weight no longer appears on ProductVariant despite docs indicating otherwise (documentation mismatch suspected).

Recommended approach (workaround/solution):

  • Retrieve weight via the inventory item path: productVariant → inventoryItem → measurement → weight { unit, value }.
  • This returns the weight and unit for the variant’s inventory item in 2024-07/2024-10.

Outcome/status:

  • A working query path was provided; reverting to 2024-04 also works but is not future-proof.
  • No official clarification on the documentation discrepancy; issue appears unresolved regarding docs vs. schema changes.

Notes:

  • Attached screenshots illustrate the error and documentation reference.
Summarized with AI on December 22. AI used: gpt-5.

Dear Shopify Support Team,

I hope this message finds you well.

I encountered an issue while trying to retrieve the weight data for a product variant using the GraphQL Admin API. Despite following the example inputs provided in the documentation, I received the following error message: “Field ‘weight’ doesn’t exist on type ‘ProductVariant.’”

Could you please advise on the correct method to access the weight data for a variant?

Thank you in advance for your assistance. I look forward to your guidance.

Best regards,
Rick

Following:

I am seeing the same error on versions 2024-07 and 2024-10 (the docs show the weight and weightUnit as existent)
Noting these fields can be accessed if you revert the version to version 2024-04

rgds
Paul

1 Like

Hi @RickUp

query {
  productVariant(id:"gid://shopify/ProductVariant/45742865645790") {
    barcode
    id
    inventoryItem{
        id
        measurement{
            id
            weight{
                unit
                value
            }
        }
    }
    inventoryQuantity
    displayName
    title
    price
    compareAtPrice
    sku
    
  }
}
3 Likes