Child pages
  • [In-Commerce] Don't mix QtyInStock and QtyReserved fields in product [5.2.1]
Skip to end of metadata
Go to start of metadata

Among other fields product/product option combination record contains following fields:

  • QtyInStock - quantity, that is available for buying
  • QtyReserved - quantity, that is blocked by submitted orders, that weren't yet shipped

Problem is with QtyInStock field, because it doesn't store quantity, that is physically present in warehouse, but difference between warehouse quantity and reserved quantity. This makes it particularly hard to perform mass-update operations on the QtyReserved field because we'd also need to update the QtyInStock field.

Solution

  1. in the QtyInStock store only quantity, that is physically available in warehouse
  2. in SQL migration script add QtyReserved to QtyInStock
  3. introduce QtyAvailable virtual/calculated field that will be:
    1. calculated as QtyInStock - QtyReserved
    2. used in placed, where QtyInStock was used

Related Tasks

MINC-115 - Getting issue details... STATUS