I want to fetch single product from GraphQL in swift

Apar1
New Member
1 0 0

Hi,

I am working on fetching products from shopify. I am able to fetch all the products from my store on shopify. But now i want to fetch single Product using productID. Which query should i put to get single product?

0 Likes
Zameer
Shopify Staff
Shopify Staff
295 32 75

Hey Apar!

You can fetch a single product by passing an argument with the ID in the correct format. You can then specify what fields you would like to have returned in the body. I've attached an example below for your reference.

{
  product(id: "gid://shopify/Product/your_product_id") {
    title
    id
  } 
}

 

0 Likes
adamjw3
Excursionist
26 0 4

This doesn't work for me

gannonmg
New Member
4 0 0

This format (and the id field) is not supported in the iOS sdk

0 Likes