0

What logic uses magento 2 for checking user login in account pages? I know about solution like $this->session->isLoggedIn(), but I need more globally for several controllers. What I need to use?

1

1 Answer 1

0
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');

if($customerSession->isLoggedIn()) 
{
// your code
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.