Why is the grams field of product variant missed in Graphql API?

jam_chan
Shopify Partner
894 23 174

I am trying to migrate a part of my REST API to GraphQL API. In particular, I try to sum different variants' weight. I can use the grams in the REST API but the field is missed in the GraphQL API. Why is it a difference?

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
Replies 2 (2)

Jason
Shopify Expert
11190 225 2283

They are different APIs so whilst there is similarities, there will be differences. GraphQL does has weight and weight unit properties that you can use to achieve the same result.

 

Is there an issue pulling the data from a different place?

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
jam_chan
Shopify Partner
894 23 174

Thanks for your prompt reply. 

 

I am trying to combine several variants into 1 new variant. The new variant is created by my app. So I was using the grams field to calculate the total weight. After that, convert the total weight in g to another weight unit for variant creation. 

 

Now the grams field is missed and it's getting a bit difficult. I try to do the unit conversion between 'g', 'kg', 'lb', 'oz' on my own. Still works but is easier to trigger a calculation error. 

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview