I’m trying to get the productCount.count for a collection when it is updated, but the webhook topic collections/update does not seem to have any data for product count.
I want to avoid having to fetch the product count using the graphql api everytime the collection is updated, as I would receive too many webhooks. Instead I want to use webhook’s include field to benefits from webhooks debouncing.
Is there a way to get the productCount.count from the collection/update webhook ? Or a way to receive webhooks only when the product count changes?
When you run the webhookSubscriptionCreate mutation, are you using the includeFields to include productsCount.count? If this isn’t possible you will need to rely on querying productsCount separately.
I also tried with products_count, productsCount.count. All these attempt led to having only the id and title, in the webhook’s data.
I just tried with all of these values, as you can in the screenshot from the partner portal:
And that’s what I get in the webhook data:
{ id: 123, title: '123' }
Can you please confirm that it’s a limitation of the API, or a wrong usage ?
If it’s not possible, is there a way to get the webhook debounced on product count somehow to avoid receiving more webhooks than necessary? That’s a serious issue to receive all webhooks when they are not necessary for us.
It does look like it won’t be possible to get the products count from the webhook. Do you need it every time the collection is updated? You might need to rely on querying directly periodically.