Closed
Description
I have DI in constructor to inject customer session to my class \Magento\Customer\Model\Session $customerSession, But the injected session object does not contain customer id or customer reference.I also checked the injected session on Magento\Catalog\Block\Product\View it also does not contain customer id or reference
public function __construct(
TemplateContext $context,
Session $customerSession,
CustomerRepositoryInterface $customerRepository,
HttpContext $httpContext,
array $data = []
) {
$this->customerSession = $customerSession;
$this->customerRepository = $customerRepository;
$this->httpContext = $httpContext;
$this->scopeConfig = $context->getScopeConfig();
parent::__construct($context, $data);
// customer session does not contain customer data
$cid=$this->customerSession->getId(); // returns null
}
Metadata
Metadata
Assignees
Labels
No labels