Product Update Webhook: find collection updated in Product

Product Update Webhook: find collection updated in Product

IamSantosh
Shopify Partner
8 1 1

Hi,

I'm facing some issues in the Product Update webhook. Whenever I'm updating name/description and other fields in the product, I'm getting a webhook response with updated field but on updating the collection of that product, there's no way I can find out if the Product's collection is updated or not. At every Product update webhook, I'd to hit two different API ("admin/api/2020-10/custom_collections.json?product_id=632910392" and "/admin/api/2020-10/smart_collections.json?product_id=632910392") for finding Custom and Smart collection associated with the Product.

Is there any way to optimize this flow because, with above mentioned flow, I'd to hit two Shopify API at every Product Update webhook call.

Please help me out here.

Reply 1 (1)

mrad
Shopify Staff (Retired)
63 10 15

Hello, if you'd like to receive updates on product collections, you can subscribe to the collections/update webhook

mrad | Developer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog