I have created some customer's custom attribute that I am using in registration process. And they are saving values properly.

Now I want show values of those custom attributes on 'customer/account/edit/' page on frontend in user's account. I am using


but showing nothing even showing 500 error in console.

Is Magento2 following different way to fetch custom attribute value. Please help me in this.


1 Answer 1


below code works for me in phtml file -

$obm = \Magento\Framework\App\ObjectManager::getInstance();

$customerSession = $obm->get('Magento\Customer\Model\Session');

if($customerSession->isLoggedIn()) {
echo $customerSession->getCustomer()->getId();
echo $customerSession->getCustomer()->getMyAttributeCode();


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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