Removing the added to your shopping cart message in Magento

In Magento, by default, when you click the add to cart or buy now button of a product, there will be a message of “(product name) was added to your shopping cart” appear on top of the main content page. This message is genereated in the addAction() function in app/code/core/Mage/Checkout/controllers.php

This message doesn’t look good on all front end theme, it’s not really necessary to show this message since whenever an item is added to cart it will show up in the mini cart on the mini cart to indicate the item is added to the cart.
To remove the “was added to your shopping cart” when clicked the add to cart button. Open up app/code/core/Mage/Checkout/controllers.php, go to the lines from 209 to 215, and replace

if (!$this->_getSession()->getNoCartRedirect(true)) {
                if (!$cart->getQuote()->getHasError()){
                    $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
                    $this->_getSession()->addSuccess($message);
                }
                $this->_goBack();
            }

with

if (!$this->_getSession()->getNoCartRedirect(true)) {
                $this->_goBack();
            }

The above is a quick hack into the Magento core files which is not recommended. Refer to How to extend a controller class and overrides its functions in Magento for proper way of doing so.

Search within Codexpedia

Custom Search

Search the entire web

Custom Search