Hello All,
After customer registration i used customer_register_success event and adminhtml_customer_save_after now i want to fetch customer details in my observer. So how can i fetch contact number of a customer in my observer.
As for customer registration from frontend contact number is not filled, so we wont be able to get contact number for customer_register_success this event.
But when we create customer from admin, i use adminhtml_customer_save_after this event. So here how can we get Contact number in my observer ?
Can anyone suggest me.
Without filling the detail from fronend, you are not able to get the data into observer.
here you can do one things, put custom attribute for number into frontend registration process and fetch those value here.
@Ankita Biswas if you check the Magento create account controller code in "vendor/magento/module-customer/Controller/Account/CreatePost.php" you will observe the customer is passed in the second argument to the dispatch method.
$this->_eventManager->dispatch( 'customer_register_success', ['account_controller' => $this, 'customer' => $customer] );
So in your observer class you can do following to get customer object
$customer = $observer->getCustomer();