---
title: "How to Solve the Issue of Product with Salable Qty 0 is not considered Out of Stock in Magento 2?"
url: "https://magecomp.com/blog/product-with-salable-qty-0-is-not-considered-out-of-stock-magento-2/"
date: "2022-01-07T10:00:20+00:00"
modified: "2025-02-17T07:03:31+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 445
reading_time: "3 min read"
summary: "Hello Magento Friends,"
description: "When a product quantity becomes 0 and it still shows in stock, you lose customer trust instantly. Learn more to solve this issue in Magento 2"
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to get a Special Price of the Product in Magento 2"
    url: "https://magecomp.com/blog/get-special-price-product-magento-2/"
  - title: "Ultimate Guide to the Best Magento 2 Extensions for 2026"
    url: "https://magecomp.com/blog/best-magento-2-extensions/"
  - title: "How to Choose the Best Magento 2 Extensions?"
    url: "https://magecomp.com/blog/choose-best-magento-2-extensions/"
---

# How to Solve the Issue of Product with Salable Qty 0 is not considered Out of Stock in Magento 2?

_Published: January 7, 2022_  
_Author: Dhiren Vasoya_  

![How to Solve the Issue of Product with Salable Qty 0 is not considered Out of Stock in Magento 2](https://magecomp.com/blog/wp-content/uploads/2022/01/How-to-Solve-the-Issue-of-Product-with-Salable-Qty-0-is-not-considered-Out-of-Stock-in-Magento-2-1024x512.webp)

**Hello Magento Friends,**

Today I am going to solve the issue of product salable quantity 0 being shown in stock in Magento 2.
[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-2.webp)](https://magecomp.com/services/hyva-theme-development/)

Preserving customer faith in your store is extremely important. Managing inventory and displaying the correct quantity status to customers is significant to provide a better user experience. Admin can immediately get the list of products that are out of stock and accordingly add more quantity by integrating [**Out of Stock Products List Extension for Magento 2**](https://magecomp.com/magento-2-out-of-stock-products-list.html).
At times Magento 2 store owners face issue of quantity availability showing in stock even if the salable quantity is 0. This has a negative experience on your store customers. So, when the salable quantity becomes 0 it should show out of stock in the frontend to customers in Magento 2.
Let’s see how you can solve the issue of a Product with a Salable Qty 0 not considered Out of Stock in Magento 2.
[![](https://magecomp.com/blog/wp-content/uploads/2022/05/Mobile-App.png)](https://magecomp.com/magento-2-mobile-app-builder)

## Steps to Solve the Issue of Product with Salable Qty 0 is not considered Out of Stock in Magento 2:
**Step 1:** Create **default.phtml** in the below path
**app\design\frontend\Themes\Yourtheme\Magento_Catalog\templates\product\view\type\**

Now add the below code
```
<?php /* @var $block MagentoCatalogBlockProductViewAbstractView */?>
<?php $_product = $block->getProduct() ?>
<?php
$stockstate = MagentoFrameworkAppObjectManager::getInstance()->get('MagentoInventorySalesApiApiGetProductSalableQtyInterface');
$sale_qty = $stockstate->execute($_product->getSku(), 1);
?>

<?php if ($block->displayProductStockStatus()): ?>
    <?php if ($_product->isAvailable() && $sale_qty > 0): ?>
        ">
            <?php /* @escapeNotVerified */ echo __('Availability:') ?>            <?php /* @escapeNotVerified */ echo __('In stock') ?>            <?php else: ?>
        ">
        	<?php /* @escapeNotVerified */ echo __('Availability:') ?>            <?php /* @escapeNotVerified */ echo __('Out of stock') ?>            <?php endif; ?>
<?php endif; ?>
```

## [![Hire Magento Programmer](https://magecomp.com/blog/wp-content/uploads/2025/02/Hire-Magento-Programmer-CTA-3.webp)](https://magecomp.com/services/hire-magento-programmer/)

## Results:
Once you apply the above code, the stock availability status in the frontend shows properly based on the scalable quantity in the backend.
### Admin Catalog Product Grid
[![admin](https://magecomp.com/blog/wp-content/uploads/2022/01/admin.png)](https://magecomp.com/blog/wp-content/uploads/2022/01/admin.png)

### Frontend Product View Page
[![frontend](https://magecomp.com/blog/wp-content/uploads/2022/01/frontend.png)](https://magecomp.com/blog/wp-content/uploads/2022/01/frontend.png)

## [![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/)

## Conclusion:
As simple as that! Try out the above solution to figure out the issue of Product with Scalable Qty 0 is showing in stock in Magento 2. For any help, you can freely reach out to us via the comment box.
If you found the solution useful, share it with your friends and colleagues. Stay in touch with us for more.
**Happy Coding!**

[![](https://magecomp.com/blog/wp-content/uploads/2021/10/Hire-Magento-2.png)](https://magecomp.com/hire-magento-developer.html)


---

_View the original post at: [https://magecomp.com/blog/product-with-salable-qty-0-is-not-considered-out-of-stock-magento-2/](https://magecomp.com/blog/product-with-salable-qty-0-is-not-considered-out-of-stock-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-08 08:04:24 UTC_  
