I'm using Magento and Magento

As we know, by default, Qty Inventory at the backend (Admin - Catalog - Manage Products - Edit - General - Inventory - Qty) may contain a negative value, such as -1.

How to prevent the quantity of inventory in the backend products is negative?

3 Answers 3


You could create a custom module and an event observer hooked to the cataloginventory_stock_item_save_before event then you can validate if the qty will be saved as negative and perform some action.






class Vendor_Module_Model_Observer
   public function stockItemSaveBefore(Varien_Event_Observer $observer)
        $item = $observer->getEvent()->getItem();
        // Perform some action ...

I don't know what do you want to do with that information. You may want to send an email, save a log or just keep the qty in 0, regardless the action you'll take this is the way to do it.


In the admin console under System -> Configuration

Under Catalog -> Inventory

You should see a setting in the Product Stock Options called Backorders. Set this to No Backorders.

Additionally set the "Qty for Item's Status to Become Out of Stock" setting to 0.


I have seen constellations where qty is negative / < zero in a very small amount of client systems that we did not create from scratch. The problem is, that the products with negative qty are "in stock/available" and can be bought by shop customers.

Instead of wasting computation time i would add a trigger:

delimiter //
CREATE TRIGGER negative_stock_to_zero BEFORE UPDATE ON cataloginventory_stock_item 
    IF NEW.qty < 0 THEN
       NEW.qty = 0;
    END IF;

Of course, you could also check if the backorder is enabled/disabled in the IF-Clause - but that's up to you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.