How to know the collection to which product belong while I receive data on product webhook

pikacho
New Member
3 0 0

My public Shopify app does two jobs:

1. Sync all products on my server using Shopify APIs once while my app is installed.

2. Register product webhooks to keep the product catalog updated at my server

  • products/create
  • products/update

For both above, I am unable to find effective way to keep the collection values to which product belongs.

Kindly suggest if how can I get collection value.

Replies 3 (3)
HunkyBill
Shopify Expert
4615 54 531

In GQL world, a product has a Collection connection, which by definition reads as: A list of the collections that include the product.

So you can use this connection.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
pikacho
New Member
3 0 0

Kindly guide me with a example as I am new to GQL.

HunkyBill
Shopify Expert
4615 54 531

You can learn a lot from right here: https://shopify.dev/api/admin-graphql#top

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com