Skip to content

Commit 8ec089f

Browse files
authored
ENGCOM-4355: Show error message when customer click on Add to cart button without selecting atleast one product from recently orderred list #21401
2 parents cd75c92 + ed810a4 commit 8ec089f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/code/Magento/Checkout/Controller/Cart/Addgroup.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
78
namespace Magento\Checkout\Controller\Cart;
89

910
use Magento\Checkout\Model\Cart as CustomerCart;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1012
use Magento\Framework\Escaper;
1113
use Magento\Framework\App\ObjectManager;
1214
use Magento\Sales\Model\Order\Item;
1315

1416
/**
17+
* Add grouped items controller.
18+
*
1519
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1620
*/
17-
class Addgroup extends \Magento\Checkout\Controller\Cart
21+
class Addgroup extends \Magento\Checkout\Controller\Cart implements HttpPostActionInterface
1822
{
1923
/**
2024
* @var Escaper
@@ -44,6 +48,8 @@ public function __construct(
4448
}
4549

4650
/**
51+
* Add items in group.
52+
*
4753
* @return \Magento\Framework\Controller\Result\Redirect
4854
*/
4955
public function execute()
@@ -74,6 +80,8 @@ public function execute()
7480
}
7581
}
7682
$this->cart->save();
83+
} else {
84+
$this->messageManager->addErrorMessage(__('Please select at least one product to add to cart'));
7785
}
7886
return $this->_goBack();
7987
}

0 commit comments

Comments
 (0)