Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    magento-hyperlocal-marketplace-guide

    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 –


    This will give output as –


    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 🙂

     

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    10 comments

  • Teja Bhagavan Kollepara
    I just checked your tutorial, Its good. But i am having another issue that, the product salable quantity is showing 0 in magento admin panel. So that the product is not showing on frontend. I am using marketplace module from webkul for my Magento2.3.2.
    • Paul Dutta (Moderator)
      Please try increasing quantity from admin panel or check your default stock.
      If the issue still persists then please raise a ticket to https://webkul.uvdesk.com
  • nikhil garg
    Sorry but i am new to magento could you tell where to put this code exactly ..
    • Paul Dutta (Moderator)
      You can use this code anywhere, like in block, controller, helper or model using this code
      $this->getSalableQuantityDataBySku->execute($sku);
      But do remember to include the declare getSalableQuantityDataBySku variable like shown.
  • GOpal Gautam
    Thanks . But i have some issue when try to ship

    * Not all of your products are available in the requested quantity.

    Magento Version – 2.3 Can you help inthis

    • Paul Dutta (Moderator)
      Can you please explain in details on what is the issue ?
  • Seniore T
    Thank you very much for your postings about new Inventory. Cannont find examples anywhere else. Helpe me a lot.
    • Paul Dutta (Moderator)
      Great 🙂
  • chris
    Hi,
    is there a way to skip the reservation ?
    We would like to skip the “The quantity of the product decrease only after shipping is completed.” part to how it was before .
    • Paul Dutta (Moderator)
      Skipping salable quantity will be a problem as it has been implemented in many places. However you can try and update this file Magento\InventoryReservations\Model\ResourceModel\GetReservationsQuantity.php, where salable quantity is calculated. So you can try and modify this file to get the product actual qty, or you can simply use previous Magento 2 version.
  • Back to Top
    css.php
    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
    Close