Q: Where exactly can I find the stock of a specified product?
A: All the stock information for every
Combination) is stored in the
You will find duplicate values in
Combination object via their
quantity fields, but they are deprecated fields that are only kept for backward compatibility and will be removed in future versions. The only true source of information for stock data is
Q: What does the StockAvailable contain exactly?
StockAvailable is associated to a
Product or a
Combination, and if you are using the multi shop feature you can also have different stock for each Shop or Shop group. Here are the details of each field:
||The remaining available quantity. This indicates how many products can still be sold in the shop. This is what the user will see on the FO if enabled. It’s also the quantity you can see on the BO’s product page.|
||The actual quantity that you have in your physical stock, in your shelves. It might be different from quantity when an Order has been purchased but is not paid, or shipped yet (see
||This indicates how many items from your physical quantity are currently reserved for your pending orders. The product has been bought by a customer but is still in your inventory, either because the order is awaiting payment or the package has not yet been sent.|
||This is the configuration defining how you want to handle this product in the FO when it is out of stock (available stock is too low).
||The location where the product is stored, to help the merchant handle their storage and prepare their packages.|
||Deprecated It was used for advanced stock management in previous versions, but is no longer used.|
physical_quantity = available_quantity + reserved_quantity;
StockAvailable::quantityas virtual quantity.
Q: When is the StockAvailable object/table updated?
A: That’s a broad question but basically for any action that should logically have an impact on the stock. When a product quantity is modified in BO, when an order is created, when the order is delivered, … However, here is a little chronology of stock quantities during a full checkout process:
|Scenario Step||virtual_quantity||physical_quantity||reserved_quantity||Side note|
|A customer decides to add 3
||For now the product is only in a cart, nothing is reserved, anyone can still buy one of the 50 remaining products.|
|The customer goes through the whole checkout process and chooses to pay by check.||
||The order has been created, but the payment is not accepted yet. Virtual quantity and reserved quantity are updated.|
|A few days later, the merchant receives the check, so they change the Order status to
||The product is now paid, but the package has still not been prepared.|
|The package is prepared and delivered to a Carrier, the order status is switched to
||The product is no longer reserved, it has actually been sent to the customer. So reserved and physical quantities can be decreased.|
Q: Where can I see and modify my Stock?
A: Although you can change the quantity directly on your product page, we strongly recommend using the
Catalog > Stock section in your BO because it is based on
StockMovement which is safer than a direct edition (read below why).
Q: Can I edit the physical or reserved quantity myself or using an ERP?
A: Avoid doing this! These two fields should be considered read-only and exist for performance reasons. They are automatically recomputed every time the stock is synchronized:
reserved_quantity_per_order = SUM(order_detail.product_quantity - order_detail.product_quantity_refunded)
physical_quantity = virtual_quantity + reserved_quantity
So in the end the only important field is the virtual quantity (
StockAvailable::quantity), the other two fields are handled by the core. You should avoid modifying them.
Q: What is a
StockMovement? What is the difference with direct edition?
A: When you edit the virtual quantity of a Product you are going to edit the
StockAvailable::quantity field directly in your database. When you modify your stock through a
StockMovement you apply a delta to your existing stock.
Q: What is the advantage of delta edition vs direct edition?
A: When you edit the virtual quantity directly, the value is saved in database, but you cannot be sure that there was no modification in stock between the moment you opened your Product page, and the moment you saved the new value. Imagine this scenario:
Great Producton stock.
That is why a
StockMovement is safer: it will not change your stock to 100, but add 50 to your current stock level instead. This way, even if the stock changes without your knowledge, the final value will remain correct.
Q: Are there any other advantages to use
A: Another advantage is that every operation (or
StockMovement) registers a log in the database. This provides you with a complete history of the stock evolution for the product, including useful details:
You can access this history in the
Catalog > Stock > Movements section from your BO.