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 to know the collection to which product belong while I receive data on product webhook

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

pikacho
Shopify Partner
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 Partner
4853 60 568

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
Shopify Partner
3 0 0

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

HunkyBill
Shopify Partner
4853 60 568

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