I want to know how to solve this problem:

I need to trigger an observer when a customer is created and one different when customer is updated.

I was using customer_save_before event which works everytime you press Save Customer, the problem with this event is that I don't know if the user is created or updated. I have tried to get the ID of the customer and do something like this:

$customer = $observer->getEvent()->getCustomer();

if($customer->getId() == null){

else {

The problem is that it always sends event $UPDATE_ACCOUNT_EVENT; It's like if the ID is created always before accessing to the observer. Is there any other event which just triggers when customer is created? so I can use that one for $CREATE_ACCOUNT_EVENT;

If not how can I check if the ID of the customer exists or not?



You can use customer_register_success event for create account event in your custom module.

Also, below is the reference link for all the events list available in Magento 2.


Hope it helps!!!

  • But is this event for admin panel? I have used this event just in frontend Sep 12 '19 at 17:30
  • You can give a try with this event in the admin, I'm not sure its working or not.
    – Sumit
    Sep 12 '19 at 17:34
  • 1
    Wow I did not believe that it could work on backend, I just put my events.xml file inside admin html, seems to work. Sep 12 '19 at 21:09
  • it's not working for me, can you bit more clarify? Sep 30 at 9:24
  • @VivekParmar you can get customer object with $customer = $observer->getEvent()->getCustomer(); in the observer and then you can use your own logic in the execute function.
    – Sumit
    Sep 30 at 11:50

There is not specific event for customer update you can try with below event


Your Answer

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

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