#19449·saleor

PRODUCT_VARIANT_STOCK_UPDATED is not triggered when order flows change stock

Author: xseignardCreated Jul 9, 2026Updated Jul 27, 2026

What are you trying to achieve?

Track stock changes of product variants through webhooks.

PRODUCT_VARIANT_STOCK_UPDATED (added in #11630) is currently only triggered by the explicit stock-edit mutations (productVariantStocksUpdate, stockBulkUpdate). None of the order flows trigger it:

  • Checkout completion (allocate_stocks) changes Stock.quantity_allocated — no event (only PRODUCT_VARIANT_OUT_OF_STOCK when availability hits 0).
  • Fulfillment (decrease_stock) decrements the physical Stock.quantity — still no PRODUCT_VARIANT_STOCK_UPDATED, only the zero-crossing events.
  • Order/fulfillment cancellation (deallocate_stock, deallocate_stock_for_orders, increase_stock restock) — same.

So an app subscribed to PRODUCT_VARIANT_STOCK_UPDATED sees manual dashboard stock edits, but is blind to the most common source of stock changes: orders. The subscription payload already exposes Stock.quantity and Stock.quantityAllocated, so the event name/payload suggest broader semantics than the current triggers deliver.

Proposed solution

Trigger PRODUCT_VARIANT_STOCK_UPDATED from the warehouse management functions whenever Stock rows are actually modified:

  • allocate_stocks (checkout completion)
  • decrease_stock (fulfillment — one event per stock with final state, no double-fire from its internal deallocation)
  • increase_stock (restock on fulfillment cancellation)
  • deallocate_stock / deallocate_stock_for_orders (order cancellation)

I have a PR ready implementing this in two commits (physical quantity changes / allocation changes) so the allocation part can be discussed or dropped independently.

Steps to reproduce the problem

  1. Create a webhook subscribed to PRODUCT_VARIANT_STOCK_UPDATED
  2. Complete a checkout, fulfill the order (variant with trackInventory: true)
  3. No webhook delivery happens, although quantityAllocated and then quantity changed

What did you expect to happen?

PRODUCT_VARIANT_STOCK_UPDATED delivered when order flows change stock.

What are your environment parameters?

Saleor main (3.24.0-a.0)