I have an app that uses magento for order processing while storing the products and prices in separate db. so it is been so difficult to capture the salable qty of products as adding products to cart depends on salable qty.

There is an API {rest}/stockStatuses/{sku} but it only takes one sku as path param.

I wanted to update in bulk or make a sync script from magento db and my db for stock.

After a lot searching Magento Dynamically Computes the salable qty based on reservations table.

i used this query to get a view that show sku, salable qty that i used to do the sync

select a.sku,a.quantity+b.salable_qty as salable_qty from magento.inventory_stock_1 a join (SELECT catalog_product_entity.sku, COALESCE(SUM(inventory_reservation.quantity), 0) AS salable_qty
FROM catalog_product_entity
LEFT JOIN inventory_reservation ON catalog_product_entity.sku = inventory_reservation.sku
GROUP BY catalog_product_entity.sku) as b on b.sku = a.sku

Note : This is not a question. i haven't found any solution here regarding this and this query can fetch me the salable qty,so sharing this for future reference.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.