Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Two webhooks from Shopify are being triggered simultaneously with different inventory

Two webhooks from Shopify are being triggered simultaneously with different inventory

KhushiShah
Shopify Partner
9 0 3

Hi,

 

I am writing to bring to your attention an issue we are experiencing with product inventory updates on our Shopify store. Specifically, we have a product (Product A) that initially has a quantity of 15 in the store. We are attempting to update the quantity of Product A to 20 using the following query:

 

"query": "mutation ProductUpdateAndInventoryActiveMutations($product: ProductInput!, $variantCount: Int!, $activeInventoryMutation #if($metaTagCount > 0)$deleteMutation#{else}#end) { $activeInventoryMutationQuery #if($metaTagCount > 0) $deleteMutationQuery #end productUpdate: productUpdate( input: $product ) { product { id: legacyResourceId metafields(first: 250) { edges { node { id key value type namespace } } } variants(first: $variantCount) { edges { node { id: legacyResourceId title } } } } userErrors { field message } } }"

 

However, we have encountered a situation where two webhooks from Shopify are being triggered simultaneously:

  1. One webhook with the quantity of 15.
  2. Another webhook with the quantity of 20.

This dual triggering of webhooks is leading to a mismatch in inventory quantities, as sometimes the webhook with 20 quantity is executed first, followed by the one with 15 quantity, which causes incorrect inventory records.

Could you please help us understand the reason behind this behavior? Any insights or guidance on how to prevent this issue from occurring would be greatly appreciated, as it is crucial for us to maintain accurate inventory levels.

 

Thank you for your assistance.

Best regards,

Khushi
Team Shipturtle

Replies 0 (0)