I would like to change default wishlist behaviour in Magento CE 1.9. By default item is removed from wishlist if quantity value set to 0. I would like to keep it in the wishlist. I would also like that when items are added to wishlist, default quantity is 0 not 1. Is this possible, any ideas?

  • One of the ideas was to create observer for "checkout_cart_update_items_before" event and set $buyRequest->setQty($itemInfo['qty']); to 0. But still, product is removed from the wishlist because of the qty not greater than 0.
    – Blaz
    Oct 23, 2015 at 9:06

1 Answer 1


Ok, I was able to identify parts of core code that control this behaviour but am unable to extend those classes to create own module.

First class is 'Mage_Wishlist_IndexController' which extends 'Mage_Wishlist_Controller_Abstract'. I modified function updateAction(). This is relevant part of the code. I only changed if sentence:

                if (isset($post['qty'][$itemId])) {
                    $qty = $this->_processLocalizedQty($post['qty'][$itemId]);
                if (is_null($qty)) {
                    $qty = $item->getQty();
                    if (!$qty) {
                        $qty = 1;
                } elseif (0 > $qty) { // I changed this from (0 == $qty)
                    try {
                    } catch (Exception $e) {
                            $this->__('Can\'t delete item from wishlist')

Now products don't get deleted anymore if $qty is set to 0

Second class is 'Mage_Wishlist_Model_Wishlist', function updateItem($itemId, $buyRequest, $params = null). I changed value at line 381, from

$qty = $candidate->getQty() ? $candidate->getQty() : 1;


$qty = 0;

And function updateItem($itemId, $buyRequest, $params = null), I changed line

$resultItem->setQty($buyRequest->getQty() * 1)



Now default value for added items is 0.

How can I create correct observer to modify those two classes? What should be the event that triggers the observer?

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.