Join us NOW for an AMA with 2H Media: Holiday Marketing for Your Shopify Store and have your marketing questions answered by marketing experts 2H Media | Plus watch the 2H Media AMA Livestream on Twitch!

How to retrieve the product category using GraphQL API?

Solved

How to retrieve the product category using GraphQL API?

panpert
Tourist
6 0 0

I've successfully retrieved the Product Type using the Product.productType field in the GraphQL API, but I'm unable to find information on how to obtain the Product Category.

Accepted Solution (1)

PageFly-Kate
Shopify Partner
1253 356 383

This is an accepted solution.

Hi @panpert 

This is Kate from PageFly - Landing page builder

To retrieve the product category in a GraphQL API, you may need to include the "category" field in your query. The exact implementation may vary depending on the specific API you're using, but it should look something like this:

query {
  product(id: "product-id") {
    productType
    category {
      title
      id
    }
  }
}

 Hope my answer will help you!

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 
➜ Weekly updated Shopify tutorials on YouTube 


All features are available from Free plan. Live Chat Support is available 24/7.

View solution in original post

Replies 2 (2)

PageFly-Kate
Shopify Partner
1253 356 383

This is an accepted solution.

Hi @panpert 

This is Kate from PageFly - Landing page builder

To retrieve the product category in a GraphQL API, you may need to include the "category" field in your query. The exact implementation may vary depending on the specific API you're using, but it should look something like this:

query {
  product(id: "product-id") {
    productType
    category {
      title
      id
    }
  }
}

 Hope my answer will help you!

Please let me know if it works by giving it a Like or marking it as a solution!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 
➜ Weekly updated Shopify tutorials on YouTube 


All features are available from Free plan. Live Chat Support is available 24/7.

panpert
Tourist
6 0 0

Thank Kate, this is exactly what I was looking for