I need some help.

I have added a custom attribute to the cataloginventory/stockitem table and now I am trying to observe the cataloginventory_stock_item_save_before event to set my custom attribute before saving.


This should be triggered every time a stock_item model is saved, thus when an order is placed or when a product saved, right? I am testing the observer with a print and die command, but it doesn't look like my observer is executed. To add to the confusion, it works fine, with the same configuration, if I call cataloginventoriy_stock_item_save_after event instead.

Anyone got a hint for me what I am doing wrong? I need to set some custom attribute in the stock_item before it is saved, alternate approaches also welcome.


1 Answer 1


Unfortunately this event does not exist (any longer - it existed in a very old version of Magento). If you look into the class Mage_CatalogInventory_Model_Stock_Item

you have this method

 * Before save prepare process
 * @return Mage_CatalogInventory_Model_Stock_Item
protected function _beforeSave()
    // see if quantity is defined for this item type
    $typeId = $this->getTypeId();
    if ($productTypeId = $this->getProductTypeId()) {
        $typeId = $productTypeId;

    $isQty = Mage::helper('catalogInventory')->isQty($typeId);

    if ($isQty) {
        if (!$this->verifyStock()) {

        // if qty is below notify qty, update the low stock date to today date otherwise set null
        if ($this->verifyNotification()) {
            $this->setLowStockDate(Mage::app()->getLocale()->date(null, null, null, false)

        if ($this->hasStockStatusChangedAutomaticallyFlag()) {
    } else {

    return $this;

it does not call the parent::_beforeSave() method which would normally dispatch the cataloginventory_stock_item_save_before event and also does not dispatch the event in the method.

  • Hmm...is this a bug or a feature?
    – Marius
    Jul 17, 2014 at 12:01
  • github.com/OpenMage/magento-mirror/blob/magento-1.3/app/code/… - I did report it as a bug a long time ago but unfortunately it didn't go very far Jul 17, 2014 at 12:07
  • That explains a lot. Thank you. I'm gonna use a separate table to store my information then and use the _after event, looks like the easiest altenative. Jul 17, 2014 at 12:22
  • Even cataloginventory_stock_item_save_after does not trigger always when a frontend order is placed (it triggers when status changes such as inStock status changes but not with normal qty decrements). I had to follow instructions from this answer magento.stackexchange.com/questions/25207/…
    – doc_id
    Jul 29, 2015 at 22:21

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.