Get product by the id of one of its variants

Highlighted
Shopify Partner
7 0 0

Can I get the product by the id of its variant in one request, via REST or GraphQL API's?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
491 97 88

Yes, product is a field on a variant to show the associated product. Here is an example: 

 

query {
productVariant(id: "gid:\/\/shopify\/ProductVariant\/1234567") {
  id
  title
  product{
    id
    title
    }
  } 
} 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes