Two webhooks from Shopify are being triggered simultaneously with different inventory

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

Hi, there

Can I ask if your webhooks are subscribed to two topics, such as product updates and inventory item updates? In other words, are there two webhook messages associated with a single webhook, or is there only one topic with two separate messages? could you log out your message topic to check?

Hey,
There is only one topic with 2 seperate messages. PFA for the logs.

Thank you

Khushi

Team Shipturtle

Hey,

Can you please confirm that can this happen due to graphql call mentioned above? Are the calls bifercated into smaller sections to update the whole product ? For instance, it first tries to update product level details, secondly inventory details, third variant details and so on.

Would appreciate an eager response for the mentioned issue.

Thank you

Khushi

Team Shipturtle