Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address

// Check if any customer is logged in or not
if (Mage::getSingleton(‘customer/session’)->isLoggedIn()) {

// Load the customer’s data
$customer = Mage::getSingleton(‘customer/session’)->getCustomer();

$customer->getName(); // Full Name
$customer->getFirstname(); // First Name
$customer->getMiddlename(); // Middle Name
$customer->getLastname(); // Last Name

// All other customer data
$customer->getWebsiteId(); // ID
$customer->getEntityId(); // ID
$customer->getEntityTypeId(); // ID
$customer->getAttributeSetId(); // ID
$customer->getGroupId(); // ID
$customer->getStoreId(); // ID
$customer->getCreatedAt(); // yyyy-mm-ddThh:mm:ss+01:00
$customer->getUpdatedAt(); // yyyy-mm-dd hh:mm:ss
$customer->getIsActive(); // 1
$customer->getCreatedIn(); // Admin
$customer->getGender(); // ID
$customer->getDefaultBilling(); // ID
$customer->getDefaultShipping(); // ID
$customer->getDob(); // yyyy-mm-dd hh:mm:ss
$customer->getTaxClassId(); // ID


29 responses to “Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address”

  1. can u explain how to get customer
    telephone number

    1. ramachandran


      1. Naseem Ahmad

        Not working this..

  2. ->getTelephone()

  3. Hugo Da Silva Marques

    How do I recover the zip?

    1. var_dump($customer->getData()) and you will see all possibilities. Zip is attached to the address. I’ll write a separate post to show how to pull the customer address.

      1. Hugo Da Silva Marques

        Thank You

      2. Have you write the post to pull the customer address? :)

          1. Thanks

  4. Susanta Kumar Das

    How can i get how many customar are login in magento. any one help me?

  5. Susanta Kumar Das

    Magento how can i get how many customer are login. any one help me?

  6. Is this code works for getting guest information?

    1. Jamie Pounder

      Obviously not…

    2. Thanks Jamie. You cannot get such information about the guest visitor. They haven’t given any personal data until they create an account. This will work for logged in customers only.


  7. Nishan S. Gill

    Hi, how can i send all this customer info via datalayer to GTM?

  8. Selva Kumar

    Hi, Is it possible to get Guest user information via Cookies in Magento?

  9. Create module in magento 2 (nodule creator 100% working)

  10. versace123mx

    I’m too new to magento and I need to get the customer email, email validate if that exists, and if there is show your name, id and telephone could help. $getmail = Mage::getModel(customer/customer)->load();

  11. how can i get customer group

  12. I think we can use: $customer->getAddresses(), to get the addresses of the customer.

  13. awesome! so complete :D

  14. Great list, Thanks

  15. Hi is there a way to extract a list of emails from all of my customers from last month?