This is my code below
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager-create('Magento\Customer\Model\Session');
if ($customerSession->isLoggedIn())
{
$customerSession->getCustomerId(); // get Customer Id
$customerSession->getCustomerGroupId();
$customerSession->getCustomer();
$customerSession->getCustomerData();
}
I'm facing a problem when full page cache is enable
on disable
it's working fine.