4

Situation: Stock = 0, in_stock = no Then I process a credit note. Stock = 1, in_stock = no

I would expect the in_stock to be set back to yes. The effect of this is that we have many T-shirts in 1 size of 1 SKU that apparently were returned some day - and now not seen in the store (so not sold). So they are in stock with qty 1, but their flag in_stock is still NO

Question: Is there a solution for this?

1 Answer 1

4
+100

I found this:

"I know it's old but because this isn't yet fixed not even in 1.7.0.1 I came up with a better solution.

Tested on 1.5.1 and above:

\app\code\core\Mage\CatalogInventory\Model\Observer.php

in

public function refundOrderInventory($observer)"

after 
Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items);

//add this
foreach ($creditmemo->getAllItems() as $item) {
    $productId = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($productId);

    if(!$product->isConfigurable()){

        $stockItem = $product->getStockItem();

        //$stockItem->setQty($item->getQty());
        $stockItem->setIsInStock(1);
        $stockItem->save();

        $product->setStockItem($stockItem);
        $product->save();
    }
}

It was taken from https://stackoverflow.com/questions/10453324/magento-credit-memo-return-to-stock-not-updating-stock-availability and they also say another possible solution (although less effective) is found here: http://wrightcreativelabs.com/blog/55-credit-memo-in-stock.html

Does this help?

1
  • Super. Maybe shoot in as a bug fix too
    – snh_nl
    Commented Dec 23, 2014 at 18:40

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.