Reputation: 11
I'm building a frontend application that uses Shopware 6 as a headless shop system. As part of this implementation, I'm using Webhook events to detect changes in the catalog.
So far, everything works quite well, but I have encountered some issues when changing the relationship between products and categories.
In the Shopware Dashboard, the user can create and update this relationship in different areas of the UI. Apparently different events are being fired depending on where the association is made.
When assigning one or more products to the category from the Category Edit UI, only the category.written
webhook is fired, but this doesn't provide any information about the actual products that were assigned. I would expect one or more product.written
Webhooks to be fired here as well, but it's not happening.
Even more critical, when de-assigning product(s) from a category, no Webhooks are being fired at all.
How can I detect if a product was de-assigned from a category if this operation doesn't trigger any events? And how do I know which products were assigned to a category if the category.written
Webhook doesn't contain this information?
Upvotes: 1
Views: 165
Reputation: 11
One of the main reasons not every event is hookable from the App System is that we do not want to DDOS the App Server. But I get your point, and maybe we should also add the product_category.written
event.
You could also depend on the category.written
event and then make some more requests to the store API to get the assigned products. Then, you could update the products in your App with the data you get from the request (making a diff or removing everything and adding the result from the request).
Feel free to open a PR or raise an issue we can handle.
Best,
Björn.
Upvotes: 1