change your event name to:declare observer
Demo/CustomerQuote/etc/frontend/events.xml
controller_action_postdispatch_customer_account_loginPost<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="controller_action_postdispatch_customer_account_loginPost">
<observer name="quote_cart" instance="Demo\CustomerQuote\Observer\QuoteObserver"/>
</event>
</config>
in events.xml fileadd observer class
And add this class \Magento\Checkout\Helper\Cart $cartHelper to your constructorDemo/CustomerQuote/Observer/QuoteObserver.php
<?php
namespace Demo\CustomerQuote\Observer;
use Magento\Checkout\Helper\Cart;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
class QuoteObserver implements ObserverInterface
{
protected $cartHelper;
public function __construct(
\Magento\Checkout\Helper\Cart Cart $cartHelper
)
{
$this->cartHelper = $cartHelper;
}
/**
* @param Observer $observer
* @return void
*/
public function execute(Observer $observer)
{
$items = $this->cartHelper->getCart()->getItems();
// Use this instead counting items
$countedCartItems = $this->cartHelper->getSummaryCount();
echo \Zend_Debug::dump(count($items));
echo $countedCartItems; \Zend_Debug::dump($countedCartItems);
exit;
returndie;
$this; }
}
Hope it helps you