Request Quote

Get Salable Quantity in Magento 2.3

Get Salable Quantity in Magento 2.3

In the latest Magento version 2.3, you might have noticed an additional quantity parameter ‘Salable Quantity‘. Today we will see how to get a product’s salable quantity in Magento 2.3

Unlike in previous versions of Magento, the quantity of a product does not decrease when an order is placed. Instead, the quantity remains the same but salable quantity gets reduced. The quantity of the product decrease only after shipping is completed.

To get salable quantity use the following code –

namespace Webkul\Module\ModelName;
use Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku;
class ClassName
    private $getSalableQuantityDataBySku;
    public function __construct(
        GetSalableQuantityDataBySku $getSalableQuantityDataBySku
    ) {
        $this->getSalableQuantityDataBySku = $getSalableQuantityDataBySku;
    public function execute(\Magento\Framework\Event\Observer $observer)
        $sku = "testsimpleproduct1";
        $salable = $this->getSalableQuantityDataBySku->execute($sku);
        echo json_encode($salable);

This will give output as –

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

Here qty is salable quantity and not the actual quantity of the product. We can get the actual quantity of the product by $product->getQty()

Hope this helps.

Happy coding 🙂


. . .


Add Your Comment

Be the first to comment.

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