Compare before/after of a Shopify webhook

Solved
keiraarts
Shopify Partner
21 3 3

Is there a way to view what changes took place in a webhook (order, product, draft_order) when it gets to delivered to an app subscribed to changes?

For example, if a merchant changes the name of a product can the webhook show that the edit only affected the name and not the other properties like the media, quantity in stock etc.

Before I built a homebrew solution I'd love to know if there's a way to access this information in webhook payloads!

Accepted Solution (1)

Accepted Solutions
Bunty
Shopify Partner
121 32 75

This is an accepted solution.

Nope, a webhook is not going to tell you what changed. The best way is to compare with the current state you hold with the inbound state.

For specific type of change, consider the Events API https://shopify.dev/api/admin-rest/2021-10/resources/event. This can be helpful when you want to take some action, for example when a product is published or unpublished (I recognise that you can do the same with the product/update topic by monitoring a specific key in the payload).

Hope this helps 

Tech Expert at Frankie - Personalizing the Shopping experience.
Frankie - empowering merchants in 206 Countries and 31 Currencies.

View solution in original post

Reply 1 (1)
Bunty
Shopify Partner
121 32 75

This is an accepted solution.

Nope, a webhook is not going to tell you what changed. The best way is to compare with the current state you hold with the inbound state.

For specific type of change, consider the Events API https://shopify.dev/api/admin-rest/2021-10/resources/event. This can be helpful when you want to take some action, for example when a product is published or unpublished (I recognise that you can do the same with the product/update topic by monitoring a specific key in the payload).

Hope this helps 

Tech Expert at Frankie - Personalizing the Shopping experience.
Frankie - empowering merchants in 206 Countries and 31 Currencies.

View solution in original post