Mar 28, 2015

Magento bug – Checkout cart 500 error – Redirect loops

Magento checkout cart gives 500 error and redirect loops when there is a shopping cart rule with Category condition.

I found a bug in Magento which redirects shopping cart indefinitely causing it 500 internal server error. This can be a serious bug as customer will not able to shop if this happens. I noticed this happens when there is a shopping cart rule which have Category in conditions of the rule.

If total quantity equals or greater than 1 for a subselection of items in cart matching ALL of these conditions:
Category is 125

So for example you have a shopping cart rule where you want to give some discount or free product if at least one product is chosen from specific Category, this triggers the error in frontend shopping cart. Main reason here is Category condition. If you remove category condition then the error should go away. But if you want to keep the category condition and still want Magento to handle the shopping cart promotion rule, check the code changes below:

To solve this I copied below file to my local

and edited the function validate:

     * Validate a condition with the checking of the child value
     * @param Varien_Object $object
     * @return bool
    public function validate(Varien_Object $object)
        /** @var Mage_Catalog_Model_Product $product */
        $product = $object->getProduct();
        if (!($product instanceof Mage_Catalog_Model_Product)) {
            $product = Mage::getModel('catalog/product')->load($object->getProductId());

        $valid = parent::validate($object);

        /* Kalpesh commented whole block, as it causes redirect loop and Segmentation fault in apache
        if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
            $children = $object->getChildren();
            //$valid = $children && $this->validate($children[0]); //Kalpesh commented, issue....

        return $valid;

Hope this helps to some troubled souls!


  • You saved my ass with this one!! Thank you kalpesh!!!

  • Hi,

    Thank you for this fix, I spent a few hours trying to work out what was wrong before finding this post.

    I have just discovered though, that by using this fix, it breaks the free shipping rule, have you come across this? I am using the WebShopApps ProductMatirx.


  • There is a patch for this

    It is marked for EE but the fix worked for us.


    - if (parent::validate($item)) {
    + if (Mage_Rule_Model_Condition_Combine::validate($item)) {

    • That worked for me on CE!

    • This saved my time. Worked great.

      Thanks For Posting.

  • Hi,

    Thanks for taking the time to post this.
    It worked on CE 🙂

  • Solution not working for Magento version Specifically for “Confugurable” products. dont know its a magento default bug or some specially third party bug. we have install all the latest “SUPEE” patches aswell. Still issue persist.

  • Dude, took me hours of googling to finally find this answer. Fantastic solution, built off of that other solution by Phil on magentoexchange that didn’t quite work. My only question is by removing this block could this mess up validation or do any unintended consequences?


    • AFAIK I didn’t had any issue, but I would still recommend to do proper testing before making the change on production.

  • Hi kalpesh,

    I need your help can you please check my website where when I click add to cart button its display 500 error.

    Website link:

    • Hi gautam. It’s impossible to know what the problem is without looking at the server error log. If using apache, it should be probably at /var/log/httpd/error_log or /var/log/apache2/error.log

  • Thank you. This helped us.

  • Hello,
    I’m using magento 2.2.3 end I have an error while configuring a shopping Cart Price Rule.
    I’m getting an error: HTTP ERROR 500
    Error Log:
    [2018-09-13 13:42:14] main.DEBUG: cache_invalidate: {“method”:”GET”,”url”:””,”invalidateInfo”:{“tags”:[“interception”,”CONFIG”],”mode”:”matchingTag”}} []

    Thank you for your help

Leave a comment


Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!




Magento top 50 contributors

Magento top 50 contributors