Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

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

Solved

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

Dave081
Shopify Partner
13 0 3

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

Accepted Solution (1)

garyrgilbert
Shopify Partner
431 41 186

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
431 41 186

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