Question

I have a simple product with a qty of 0. I'm setting the manage_product to 0 like this:

$

product = Mage::getModel("catalog/product")->load($nextId);

        $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product->getId());

        $stockItem->setData('use_config_manage_stock', 0);
        $stockItem->setData('manage_stock', 0);
        $stockItem->save();

However, even though the quantity is 0, when I call $product->getStockStatus(); in another script, it's returning the product as in stock!

I tried reindexing, checked that the quantity to put out of stock is 0 in the configuration tab, but nothing seems to work. I even tried changing manage_stock from the CMS, but it still doesn't fix it.

Why is that happening? How can I solve this issue?

Was it helpful?

Solution

It's not a bug, it's a feature.

When you set "Manage Stock" to No that means there is no inventory management, thus the product is always in stock and has got an infinte stock.

More information here: http://merch.docs.magento.com/ee_docs/content/catalog/inventory-manage-stock.html

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top