0

How to get the customer name from the observer - magento 2. From the event customer_register_success.

I tried like this but i got an error.

$customer = $observer->getEvent()->getCustomer();
$customer_id = $customer->getId();
$customer_email = $customer->getEmail();
$customer_name = $customer->getName();

I know i can get the name from customer session. what i want here is i want to get the name from getEvent

  • 1
    Did you tried $customer->getFirstName(); ? – Pankaj Pareek Oct 9 '17 at 12:08
  • 1
    Use $customer->getFirstName() or $customer->getLastName() – Prince Patel Oct 9 '17 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.