{"id":1821,"date":"2021-07-02T10:11:16","date_gmt":"2021-07-02T10:11:16","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/get-salable-quantity-information-after-product-is-saved-in-magento-2\/"},"modified":"2025-06-16T11:48:17","modified_gmt":"2025-06-16T06:18:17","slug":"get-salable-quantity-information-after-product-is-saved-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/get-salable-quantity-information-after-product-is-saved-in-magento-2\/","title":{"rendered":"How to Get Salable Quantity Information After Product is Saved in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The concept of salable quantity is introduced with the release of&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-3-3-release\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2.3.3<\/a>&nbsp;with the multi-source inventory system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Salable quantity is the sum of all available items that allows you to handle all of your warehouses and get changed when the order is placed or the physical quantity in the warehouse changes. Know the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-salable-quantity-vs-quantity\/\" target=\"_blank\" rel=\"noreferrer noopener\">difference between Magento 2 Salable Quantity and Quantity<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You might have noticed the \u2018salable quantity\u2019 column in the product grid. However,&nbsp;what if you want to programmatically&nbsp;<em><strong>get salable quantity information after product is saved in Magento 2<\/strong><\/em>&nbsp;to maintain the well-structured inventory grid?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For instance, you want to keep track of the changes in the salable quantity in the\u00a0<a href=\"https:\/\/meetanshi.com\/magento-2-inventory-report.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 inventory report<\/a>\u00a0when product quantity gets changed from the product page.\u00a0<a href=\"https:\/\/meetanshi.com\/blog\/get-product-salable-quantity-in-magento-2\/\">Get product salable quantity<\/a>\u00a0because salable quantity is the sum of available resources, grouped in stocks to get quantity information after product is saved. There are many <a href=\"https:\/\/meetanshi.com\/blog\/best-magento-2-inventory-report-extensions\/\" data-type=\"link\" data-id=\"https:\/\/meetanshi.com\/blog\/best-magento-2-inventory-report-extensions\/\">inventory report extensions<\/a> that help business owners automatically list and track product changes to effectively keep your inventory in check<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Also read:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/meetanshi.com\/blog\/get-product-stock-information-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Get Product Stock Information in Magento 2<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In such a scenario, use the below code and perform further operations based on the detail of salable quantity information after a product is saved.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Get Salable Quantity Information After Product is Saved in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create&nbsp;<strong>Registration.php&nbsp;<\/strong>file at&nbsp;<strong>app\/code\/Vendor\/Module\/<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\nuse Magento\\Framework\\Component\\ComponentRegistrar;\n\nComponentRegistrar::register(\n    ComponentRegistrar::MODULE,\n    'Vendor_Module',\n    __DIR__\n);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create&nbsp;<strong>module.xml<\/strong>&nbsp;file at&nbsp;<strong><strong>app\/code\/Vendor\/Module\/etc<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n        xsi:noNamespaceSchemaLocation=\"urn:magento:framework:Module\/etc\/module.xsd\">\n    &lt;module name=\"Vendor_Module\" setup_version=\"1.0.0\">\n    &lt;\/module>\n&lt;\/config><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Create<strong>&nbsp;di.xml<\/strong>&nbsp;file at&nbsp;<strong><strong>app\/code\/Vendor\/Module\/etc\/<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!--?xml version=\"1.0\"?--><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Create&nbsp;<strong>GetSalableQuantityAfterProductSave.php<\/strong>&nbsp;file at&nbsp;<strong>app\/code\/Vendor\/Module\/Helper\/&nbsp;<\/strong>and use the below code:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\n\nnamespace Vendor\\Module\\Helper;\n\n\nuse Magento\\Framework\\App\\Helper\\AbstractHelper;\nuse Magento\\Framework\\App\\Helper\\Context;\nuse Magento\\InventorySalesAdminUi\\Model\\GetSalableQuantityDataBySku;\n\n\/**\n * Class GetSalableQuantityAfterProductSave\n\n *\/\nclass GetSalableQuantityAfterProductSave extends AbstractHelper\n{\n    \/**\n     * @var GetSalableQuantityDataBySku\n     *\/\n    private $getSalableQuantityDataBySku;\n\n    \/**\n     * GetSalableQuantityAfterProductSave constructor.\n     * @param GetSalableQuantityDataBySku $getSalableQuantityDataBySku\n     * @param Context $context\n     *\/\n    public function __construct(GetSalableQuantityDataBySku $getSalableQuantityDataBySku, Context $context)\n    {\n        parent::__construct($context);\n        $this->getSalableQuantityDataBySku = $getSalableQuantityDataBySku;\n    }\n\n    \/**\n     * @param $productSku\n     * @return array\n     *\/\n    public function getSalableQuantityAfterProductSave($productSku){\n        return $this->getSalableQuantityDataBySku->execute($productSku);\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it! <br><br>Do you still have any queries? Ask in the comments. I\u2019d be happy to help you. Feel free to share this solution with your friends via social media. Thanks for reading!<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>The concept of salable quantity is introduced with the release of&nbsp;Magento 2.3.3&nbsp;with the multi-source inventory system. Salable quantity is the sum of all available items&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1821","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1821"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1821\/revisions"}],"predecessor-version":[{"id":16812,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1821\/revisions\/16812"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}