Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    How to save and get source inventory in Magento 2

    In Magento 2.3, a new feature was introduced Multi Source Inventory aka MSI. It changes how the product inventory works. With this feature a product can be assigned multiple sources and each source can have different quantity of the product.

    In this blog I will explain how to save product quantities for multiple sources and how to retrieve the saved quantities. Here I will create a product with sku “test_product” and two source with source code “test_source” and “test_source2“. Please make sure that you have added the sources in the stock and selected the source channel in stock.

    1. Save product quantities for multiple sources

    Please note that if you want to update quantity for a single product then you can not just pass single array in the data. If you do then it will remove the previous sources. So now if you do,

    then it will remove the other source like shown below


    2. Get the product’s multi-source quantities

    It returns the source wise quantities in array.


    To get the saleable quantity you can check,

    Get Salable Quantity in Magento 2.3


    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again