added 32 characters in body
Source Link
Qaisar Satti
  • 31.8k
  • 16
  • 78
  • 132

You must call object in magento 2 for custom coding in any page. so code will look like this

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

if($customerSession->isLoggedIn()){

//Code

}

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

if($customerSession->isLoggedIn()){

//Code

}

You must call object in magento 2 for custom coding in any page. so code will look like this

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

if($customerSession->isLoggedIn()){

//Code

}

You must call object in magento 2 for custom coding in any page. so code will look like this

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

if($customerSession->isLoggedIn()){

//Code

}
Source Link

You must call object in magento 2 for custom coding in any page. so code will look like this

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

if($customerSession->isLoggedIn()){

//Code

}