Some products are one pile of stock wearing several variant names. Shopify will happily track each variant on its own. Sell one, and the siblings still say they have the old count. Recount Kit treats those variants as a pool and lets Shopify stay the source of truth.
The webhook
Shopify sends inventory_levels/update when available quantity changes at a location. The handler turns the numeric ids into inventory-item and location gids, then looks for a pool member at that shop and location.
No member, no work. One member and no siblings, no work. The interesting case is a sibling whose available count does not match.
The handler reads the source item’s available quantity, then reads each sibling. If a sibling already matches, it skips that write. That skip is the whole loop prevention. Updating a sibling fires the same webhook again. If you write when nothing changed, you chase your own tail.
If it does not match, the difference in available quantity is applied to the sibling’s on-hand count, with compareQuantity set to the on-hand value just read. Someone else moving that number between the read and the write fails the compare instead of getting silently overwritten.
The rest of the app
Pools are the webhook. Stocktakes are a different path: load expected on-hand, type a count, review the variance, then commit. Reorder points are another: when available stock is at or below the point you saved, the app drafts a purchase order for target stock minus available, grouped by supplier. I wrote that calculation up in how to calculate a reorder point and set it in Shopify.