I am trying to get First Name and Last Name from the session.
But I am not able to get First name or last name.
Instead, I am able to get the full name.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$customerSession = $objectManager->create('Magento\Customer\Model\Session');
$customer_name = $customerSession->getCustomer()->getName(); // gives me result
But when I try to get first it returns null
$customer_first_name = $customerSession->getCustomer()->getFirstName(); // gives me null
How to get the first name using customerSession->getCustomer()