---
title: "How to Get Product Salable Quantity in Magento 2?"
url: "https://magecomp.com/blog/get-product-salable-quantity-magento-2/"
date: "2022-02-21T14:57:20+00:00"
modified: "2025-02-18T05:28:05+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 273
reading_time: "2 min read"
summary: "In today’s Magento 2 tutorial, I am going to illustrate how to obtain a salable quantity of product in Magento 2."
description: "Salable Quantity is different from quantity. Get salable quantity in Magento 2 using getSalableQtyBySku() function. Learn more"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to disable Ajax Add to Cart on Product page in Magento 2"
    url: "https://magecomp.com/blog/disable-ajax-add-cart-product-page-magento-2/"
  - title: "Best Magento 2 Web Push / Firebase Notification Extension Providers in 2026"
    url: "https://magecomp.com/blog/best-magento-2-web-push-notification-extension-providers/"
  - title: "Magento 2: How to Skip Categories from Breadcrumbs on the Category Page"
    url: "https://magecomp.com/blog/magento-2-skip-categories-from-breadcrumbs-on-category-page/"
---

# How to Get Product Salable Quantity in Magento 2?

_Published: February 21, 2022_  
_Author: Dhiren Vasoya_  

![How to Get Product Salable Quantity in Magento 2](https://magecomp.com/blog/wp-content/uploads/2022/02/How-to-Get-Product-Salable-Quantity-in-Magento-2-1024x512.webp)

In today’s Magento 2 tutorial, I am going to illustrate how to obtain a salable quantity of product in Magento 2.
The functionality of Salable Quantity was introduced first with the release of Magento 2.3. Salable quantity allows managing the warehouse and avoiding out-of-stock conditions.
[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-2.webp)](https://magecomp.com/services/magento-upgrade-services/)

When an order is issued the quantity of the product does not reduce. Only the salable quantity is decreased. The quantity decreases after the order is shipped. Hence, the quantity and salable quantity are not always the same.
Solve the issue – [**quantity availability showing in stock even if the salable quantity is 0**](https://magecomp.com/blog/product-with-salable-qty-0-is-not-considered-out-of-stock-magento-2/)

Admin needs to keep an eye on salable quantity to manage inventory. Use the following code to get the salable quantity of product in Magento 2.
## Steps to Get Product Salable Quantity in Magento 2:
**Step 1:** Create the following helper file in your extension
**app\code\Vendor\Extension\Helper\Data.php**

Then add the below code
```
<?php

namespace VendorExtensionHelper;

use MagentoFrameworkAppHelperAbstractHelper;
use MagentoFrameworkAppHelperContext;
use MagentoInventorySalesAdminUiModelGetSalableQuantityDataBySku;

class Data extends AbstractHelper
{
      private $getSalableQtyDataBySku;

      public function __construct(
             Context $context,
             GetSalableQuantityDataBySku $getSalableQtyDataBySku
      ){
             $this->getSalableQtyDataBySku = $getSalableQtyDataBySku;
             parent::__construct($context);
       }

       public function getSalableQtyBySku($sku)
       {
 	           $salable = $this->getSalableQuantityDataBySku->execute($sku);
	           return json_encode($salable);
       }
}
```

[![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2023/04/Magento-Malware-Removal-CTA-1.webp)](https://magecomp.com/magento-malware-removal.html)

**You will get the following Output:**

```
 [{"stock_name":"Default Stock","qty":100,"manage_stock":true}]
```

## Conclusion:
And that’s it! You can easily fetch the salable quantity of product in Magento 2. If you are unable to get the desired output of a salable quantity, reach out to me via the comment section. Share the solution with your friends and stay updated for more tutorials.
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-3.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/get-product-salable-quantity-magento-2/](https://magecomp.com/blog/get-product-salable-quantity-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-18 07:51:03 UTC_  
