I am instantiating the customer session helper (\Magento\Customer\Model\Session $customerSession
) correctly, but this function always returns false, even though the customer is logged in. What am I missing here?
Magento2 – Fix Customer Session isLoggedIn() Always Returns False
customer-sessionloginmagento2
Best Answer
If store cache is enable, you can not get customer session. Check below code for get customer session with enable cache.
Write above code in block, It is working even cache is enable.