Customer has already Items in Cart. He is logout.
I'm using customer_login
observer. It is correct?
How to get customers all cart information after his successfull login?
namespace Custom\Module\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\ObjectManager;
class CustomerLoginAfter implements ObserverInterface {
protected $checkoutSession;
protected $cart;
public function __construct(\Magento\Checkout\Model\Session $checkoutSession, \Magento\Checkout\Model\Cart $cart) {
$this->checkoutSession = $checkoutSession;
$this->cart = $cart;
}
public function execute(Observer $observer) {
$quoteItemsAll = $this->checkoutSession->getQuote()->getAllItems();
echo count($quoteItemsAll);
exit;
return $this;
}
}
It gives 0 count. While I already have 6 Items in Cart.
How to get customer's previous quote & it's items?