Differentiate 'Product-update' webhook on Creating an order and updating a product

Differentiate 'Product-update' webhook on Creating an order and updating a product

Rahul-wk
Shopify Partner
4 0 0

Shopify sends webhook of 'product-update' in both cases- Updating a product AND creating an Order. On creating orders, product quantity is deducted from 1st location which is mentioned as per location fulfillment priority. My problems are-

  1. I want to differentiate 'product-update' webhook such that is it coming due to updating the product OR creating an order.

  2. Is there any way in shopify REST API to get the locations as per fulfillment priorities?

Thanks,

Replies 4 (4)

Jayvin
Shopify Partner
284 42 89

Hi,

Just read the X-Shopify-Topic from http headers when you receive the webhook on your app. More info here 

banned
Rahul-wk
Shopify Partner
4 0 0

Thanks, But I have checked this. The 'X-Shopify-Topic' gives the value 'products/update' in both cases- on updating product and on product update for order creation. So, same value in both cases. Bad luck. 😞

Jayvin
Shopify Partner
284 42 89

Hi,

Yes, logically the product/update webhook will also fire after the order/created webhook has fired.

By the way, why do you want to differentiate between a 'normal' product/update and when product/update webhook occurs from order/created webhook?

banned
Rahul-wk
Shopify Partner
4 0 0

Its my app requirement.