Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Retrieving Variant Weight Data via GraphQL Admin API

Solved

Retrieving Variant Weight Data via GraphQL Admin API

RickUp
Shopify Partner
5 0 0

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.

RickUp_0-1723453470893.png

RickUp_1-1723453532098.png

Best regards,
Rick

 

 

Accepted Solutions (2)

Gnilya
Shopify Partner
3 1 1

This is an accepted solution.

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

View solution in original post

Kyle_liu
Shopify Partner
394 51 68

This is an accepted solution.

Hi@RickUp 

 

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

 

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee

View solution in original post

Replies 2 (2)

Gnilya
Shopify Partner
3 1 1

This is an accepted solution.

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

Kyle_liu
Shopify Partner
394 51 68

This is an accepted solution.

Hi@RickUp 

 

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

 

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee