I have to remove the You need to choose options for your item. on Add to cart button when I don't select any color or size.
I don't want to show this as a global message.

I found that Add to cart is an ajax call . But I am not able to debug how this You need to choose options for your item. is getting set and how can I remove it?


Add below code before this line: $this->cart->addProduct($product, $params); in


    $redirectUrl = $product->getProductUrl();
    return $this->goBack($redirectUrl);

Please override this controller do not change in core.

  • There is no such method hasOptionsValidationFail() in /vendor/magento/module-checkout/Controller/Cart/Add.php – summu Mar 13 '19 at 6:18
  • It's working. I have tried and then answer. You'll find this method in /vendor/magento/module-checkout/Model/Cart.php 383. Please check. – Ravi Soni Mar 13 '19 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.