{"id":378615,"date":"2023-04-27T09:19:32","date_gmt":"2023-04-27T09:19:32","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=378615"},"modified":"2024-06-18T10:47:46","modified_gmt":"2024-06-18T10:47:46","slug":"salable-quantity-filter-in-product-collection-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/","title":{"rendered":"Adding Salable Quantity Filter in Product Collection in Magento 2"},"content":{"rendered":"\n<p>Hello Friends!!!<\/p>\n\n\n\n<p>In this blog, we will learn how we can add the salable quantity filter to product collection.<\/p>\n\n\n\n<p>Magento version &gt;= 2.3.0, already provides <strong><a href=\"https:\/\/devdocs.magento.com\/guides\/v2.3\/inventory\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Multi-Source Inventory (MSI)<\/a><\/strong> to manage the <a href=\"https:\/\/webkul.com\/blog\/introduction-to-magento2-multi-source-inventory\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 inventory<\/a> and sources, which helps merchants manage the stocks of their stores&#8217; catalog.<\/p>\n\n\n\n<p><strong>Why do we need this filter?<\/strong><\/p>\n\n\n\n<p>Suppose, you are using the default source for your store catalog, and then you enable MSI and create a few other sources.<\/p>\n\n\n\n<p>For example, you created a new source &#8216;Test Source&#8217; and assigned a &#8216;Test Stock&#8217; to this source.<br>Then make this &#8216;Test Source&#8217; as the default source of your website. And assigned inventory to products in Test Stock.<\/p>\n\n\n\n<p>And after placing or completing the <a href=\"https:\/\/store.webkul.com\/magento2-pre-order.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 orders<\/a> for some products which have inventory in both stocks(default and test), you switched back to &#8216;Default Source&#8217;.<\/p>\n\n\n\n<p>Thus, in some scenarios, you can see the salable quantity might be changed from the in_stock quantity.<br>Refer to the following screenshots for example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" width=\"1200\" height=\"609\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png\" alt=\"ProductSku\" class=\"wp-image-378619\" style=\"width:820px;height:416px\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-300x152.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-250x127.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-768x390.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku.png 1302w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"651\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder-1200x651.png\" alt=\"ProductStockBeforeOrder\" class=\"wp-image-378622\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder-1200x651.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder-300x163.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder-250x136.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder-768x416.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockBeforeOrder.png 1304w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"648\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore-1200x648.png\" alt=\"ProductSalableQuantityBefore\" class=\"wp-image-378623\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore-1200x648.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore-300x162.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore-250x135.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore-768x415.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQuantityBefore.png 1305w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>In the above screenshots, you can see there is a product with SKU &#8216;MG-7589654&#8217; and it has in_stock quantity of 94, and the salable quantity is 67.<\/p>\n\n\n\n<p>So after placing\/completing the order for 67 quantity, its salable quantity will be 0(zero), and the in_stock quantity will be 27(look at the below screenshot). <\/p>\n\n\n\n<p>So, at the front end, this product will be displayed and when we will try to add it to the cart, we will get a &#8216;<mark class=\"has-inline-color has-vivid-red-color\">The requested qty is not available<\/mark>&#8216; error message(refer to the below 3rd screenshot).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"652\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder-1200x652.png\" alt=\"ProductStockAfterOrder\" class=\"wp-image-378627\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder-1200x652.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder-300x163.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder-250x136.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder-768x417.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductStockAfterOrder.png 1304w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"651\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder-1200x651.png\" alt=\"ProductSalableQtyAfterOrder\" class=\"wp-image-378628\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder-1200x651.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder-300x163.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder-250x136.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder-768x417.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSalableQtyAfterOrder.png 1295w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"617\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg-1200x617.png\" alt=\"QtyIsNotAvailableMsg\" class=\"wp-image-378630\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg-1200x617.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg-300x154.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg-250x128.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg-768x395.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/QtyIsNotAvailableMsg.png 1304w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>So, in this scenario, if we want to display only salable products at the front end. Then we can use this solution.<\/p>\n\n\n\n<p><strong>Solution:<\/strong> <\/p>\n\n\n\n<p>Here, I have created a <strong>ListProducts.php <\/strong>Controller inside the <em>&lt;magento-root-dir.&gt;\/app\/code\/Webkul\/Demo\/Controller\/Index\/ <\/em>directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Webkul Software.\n *\n * @category  Webkul\n * @package   Webkul_Demo\n * @author    Webkul Software Private Limited\n * @copyright Copyright (c) Webkul Software Private Limited (https:\/\/webkul.com)\n * @license   https:\/\/store.webkul.com\/license.html\n *\/\n\nnamespace Webkul\\Demo\\Controller\\Index;\n\nuse Magento\\Framework\\App\\Action\\Action;\nuse Magento\\Framework\\App\\Action\\Context;\nuse Magento\\Catalog\\Model\\ResourceModel\\Product\\CollectionFactory;\n\n\/**\n * ListProducts class to get list of products.\n *\/\nclass ListProducts extends Action\n{\n    \/**\n     * @var CollectionFactory\n     *\/\n    private $collectionFactory;\n\n    \/**\n     * @var \\Magento\\CatalogInventory\\Helper\\Stock\n     *\/\n    private $stockFilter;\n\n    \/**\n     * Initialize dependencies\n     * \n     * @param Context $context\n     * @param CollectionFactory $collectionFactory\n     * @param \\Magento\\CatalogInventory\\Helper\\Stock $stockFilter\n     * @return void\n     *\/\n    public function __construct(\n        Context $context,\n        CollectionFactory $collectionFactory,\n        \\Magento\\CatalogInventory\\Helper\\Stock $stockFilter\n    ) {\n        $this-&gt;stockFilter = $stockFilter;\n        $this-&gt;collectionFactory = $collectionFactory;\n        parent::__construct($context);\n    }\n\n    \/**\n     * Execute method to show data\n     *\/\n    public function execute()\n    {\n        $collection = $this-&gt;collectionFactory-&gt;create()\n            -&gt;addFieldToSelect(&#091;&quot;*&quot;, &#039;SUM(ir.quantity) as qtyTotal&#039;, &#039;name&#039;]);\n        \n        \/\/\/Add in stock filter\n        $this-&gt;stockFilter-&gt;addInStockFilterToCollection($collection);\n\n       \/\/\/Code to add is salable filter\/\/\/\/\n        $subquery = new \\Zend_Db_Expr(\n            &#039;(SELECT SUM(`ir`.quantity) as rqty, `ir`.sku FROM `inventory_reservation` AS `ir` GROUP BY `ir`.sku)&#039;\n        );\n\n        $collection-&gt;getSelect()-&gt;join(\n            &#091;&#039;DT&#039; =&gt; $subquery],\n            &quot;`e`.sku = `DT`.sku&quot;, &#091;]\n        )-&gt;where(&quot;(`at_inventory_in_stock`.`qty` + `DT`.rqty) &gt; 0&quot;);\n        \/\/\/\/\/\/\/\/\/\/\/\/\n\n        var_dump($collection-&gt;getData());\n        die;\n    }\n}<\/pre>\n\n\n\n<p>When you will hit this controller on the browser, you will see the result in the below images.<\/p>\n\n\n\n<p><strong>Case 1:<\/strong> When product (SKU: MG-7589654) in_stock quantity is 94 and salable quantity is 67.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"610\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented-1200x610.png\" alt=\"WhenFilterCodeIsCommented\" class=\"wp-image-378631\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented-1200x610.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented-300x153.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented-250x127.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented-768x390.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/WhenFilterCodeIsCommented.png 1306w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Case 2:<\/strong> When product (SKU: MG-7589654) in_stock quantity is 27 and salable quantity is 0.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"555\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied-1200x555.png\" alt=\"FilterisApplied\" class=\"wp-image-378632\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied-1200x555.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied-300x139.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied-250x116.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied-768x355.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/FilterisApplied.png 1286w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>If you are using our <strong><a href=\"https:\/\/store.webkul.com\/magento2-multi-vendor-marketplace.html\" target=\"_blank\" rel=\"noreferrer noopener\">Marketplace Multi Vendor Module for Magento 2<\/a><\/strong> module and want to manage inventory using MSI, you can check our extension <strong><a href=\"https:\/\/store.webkul.com\/magento2-marketplace-multi-source-inventory.html\" target=\"_blank\" rel=\"noreferrer noopener\">Marketplace MSI for Magento 2<\/a><\/strong>.<\/p>\n\n\n\n<p>Hope this will be helpful.<\/p>\n\n\n\n<p>Thanks \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends!!! In this blog, we will learn how we can add the salable quantity filter to product collection. Magento version &gt;= 2.3.0, already provides Magento 2 Multi-Source Inventory (MSI) to manage the Magento 2 inventory and sources, which helps merchants manage the stocks of their stores&#8217; catalog. Why do we need this filter? Suppose, <a href=\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":249,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1833,302,8884,1],"tags":[14085,14083,14084,14680,14082],"class_list":["post-378615","post","type-post","status-publish","format-standard","hentry","category-magento-marketplace","category-magento2","category-magento2-marketplace","category-uncategorized","tag-apply-is-salable-filter","tag-how-to-add-salable-quantity-filter-in-product-collection-in-magento-2","tag-is_salable","tag-salable-quantity-filter","tag-salable-quantity-filter-in-product-collection-in-magento-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Hello Friends!!! In this blog, we will learn how we can add the salable quantity filter to product collection. Magento version &gt;= 2.3.0, already provides Magento 2 Multi-Source Inventory (MSI) to manage the Magento 2 inventory and sources, which helps merchants manage the stocks of their stores&#8217; catalog. Why do we need this filter? Suppose, [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-27T09:19:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-18T10:47:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png\" \/>\n<meta name=\"author\" content=\"Khushboo Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khushboo Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\"},\"author\":{\"name\":\"Khushboo Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\"},\"headline\":\"Adding Salable Quantity Filter in Product Collection in Magento 2\",\"datePublished\":\"2023-04-27T09:19:32+00:00\",\"dateModified\":\"2024-06-18T10:47:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\"},\"wordCount\":383,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png\",\"keywords\":[\"apply is salable filter\",\"How to Add Salable Quantity Filter in Product Collection in Magento 2\",\"is_salable\",\"Salable Quantity Filter\",\"Salable Quantity Filter in Product Collection in Magento 2\"],\"articleSection\":[\"Magento Marketplace\",\"Magento2\",\"Magento2 marketplace\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\",\"name\":\"Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png\",\"datePublished\":\"2023-04-27T09:19:32+00:00\",\"dateModified\":\"2024-06-18T10:47:46+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku.png\",\"width\":1302,\"height\":661,\"caption\":\"ProductSku\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding Salable Quantity Filter in Product Collection in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\",\"name\":\"Khushboo Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Khushboo Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog","og_description":"Hello Friends!!! In this blog, we will learn how we can add the salable quantity filter to product collection. Magento version &gt;= 2.3.0, already provides Magento 2 Multi-Source Inventory (MSI) to manage the Magento 2 inventory and sources, which helps merchants manage the stocks of their stores&#8217; catalog. Why do we need this filter? Suppose, [...]","og_url":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-04-27T09:19:32+00:00","article_modified_time":"2024-06-18T10:47:46+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png","type":"","width":"","height":""}],"author":"Khushboo Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Khushboo Sahu","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/"},"author":{"name":"Khushboo Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca"},"headline":"Adding Salable Quantity Filter in Product Collection in Magento 2","datePublished":"2023-04-27T09:19:32+00:00","dateModified":"2024-06-18T10:47:46+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/"},"wordCount":383,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png","keywords":["apply is salable filter","How to Add Salable Quantity Filter in Product Collection in Magento 2","is_salable","Salable Quantity Filter","Salable Quantity Filter in Product Collection in Magento 2"],"articleSection":["Magento Marketplace","Magento2","Magento2 marketplace"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/","name":"Adding Salable Quantity Filter in Product Collection in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku-1200x609.png","datePublished":"2023-04-27T09:19:32+00:00","dateModified":"2024-06-18T10:47:46+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/04\/ProductSku.png","width":1302,"height":661,"caption":"ProductSku"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/salable-quantity-filter-in-product-collection-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Adding Salable Quantity Filter in Product Collection in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca","name":"Khushboo Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Khushboo Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/378615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/249"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=378615"}],"version-history":[{"count":12,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/378615\/revisions"}],"predecessor-version":[{"id":448512,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/378615\/revisions\/448512"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=378615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=378615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=378615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}