Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi,
Is there any way to get a product detail using the product variant id? I am using the store front GraphQL. Once I create a Cart and CartLine , there is only product variant id , so in the cart page i would like to show the product info like like name , image etc,
Yes, you can use the productVariant
field to get detail of the product variant using its id. Like this:-
{ productVariant(id: "YOUR_PRODUCT_VARIANT_ID")
{
id
title
image
{
originalSrc
altText
}
}
}