New Shopify Certification now available: Liquid Storefronts for Theme Developers

How can I get the price of a specific product using GraphQL?

Solved
Dave081
Shopify Partner
13 0 3

I only need to know the price of a specific product. Please

Accepted Solution (1)
garyrgilbert
Shopify Partner
378 38 151

This is an accepted solution.

You always need the productvariant id of the product.  Every product in shopify has a variant, even if it doesn't look like it has a variant, and the price is always attached to the variant.

 

{
productVariant(id: "gid://shopify/ProductVariant/{productvariant_id}") {
price
}
}

 

Just replace {productvariant_id} with the actual product variant id and you will get the price back.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution

View solution in original post

Reply 1 (1)
garyrgilbert
Shopify Partner
378 38 151

This is an accepted solution.

You always need the productvariant id of the product.  Every product in shopify has a variant, even if it doesn't look like it has a variant, and the price is always attached to the variant.

 

{
productVariant(id: "gid://shopify/ProductVariant/{productvariant_id}") {
price
}
}

 

Just replace {productvariant_id} with the actual product variant id and you will get the price back.

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution