Home » Magento1 February 2012

Magento: How to get product stock quantity & other stock information?

Here is a quick code to get any product’s stock information like quantity (qty), minimum quantity (min_qty), stock availability (is_in_stock), minimum and maximum sale quantity (min_sale_qty and max_sale_qty), etc.

First load the product. Product can be loaded in different ways. Here are the two different ways to load any product in Magento:-

1. Load product by product ID

2. Load product by SKU

Get stock information of the loaded product

You can check stock data in this way:-

Or, you can print individually like this:-

Hope this helps. Thanks.


Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Subesh Pokharel

    Not Working… where is the reference to $stock>>

  • Subesh Pokharel

    Not Working… where is the reference to $stock>>

  • BC

    I would love to see this code extended to include an update query to the product quantity and product status flags. We’re thinking through how best to link and update changes to inventory made externally to Magento.

  • Emil Kroer

    Just what i needed 

  • Rick

    Finally I find the right snippet. Thank you! :)

  • Rooney

    Very useful code. Thank you for sharing.

  • I need a help.
    I have configurable products and i want that the drop down shows me, even if the product is out-of-stock. Whit the anouce “this size is out of stock”.
    Can You help me!

  • Salam OITL

    Thank you. It’s work for me

  • Shantnu Shrama

    very very thanks