Magento – Get Product Stock Quantity

Share

To get the quantity in stock for a particular product in Magento use the following code –

$qtyStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
This entry was posted in Magento, PHP and tagged , . Bookmark the permalink.
 

3 Responses to Magento – Get Product Stock Quantity

  1. Julec says:

    How to change it, just to show only if quantity is bigger than 0=zero
    Or to show some graphics icon when quantity is >0
    thanks

  2. kalyan says:

    loadByProduct($_product)->getQty();
    if($qtyStock>0)
    — here your code if there is available quantity–
    else
    echo “”;

    ?>

  3. jeeva says:

    where i can add this code

Leave a Reply

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

*