I have created an observer on the customer_save_before event. Surprisingly $observer->getEvent()->getCustomer()->getOrigData() is null. Is my expectation wrong?

This is also happening for customer_save_commit_after.

I am looking for an event for which the customer data (new and original) is available, that ideally takes place after the new data was persisted in the db, independent of the area from which it is called frontend or adminhtml.

I have logged all the events that are being dispatched throughout my save customer process and the two events mentioned above made the most sense.

Is there such an event?



 return null because it never loaded.

Reference Link

  • 3 year old bug. They closed it too. Wow. – Dominic Xigen May 22 '19 at 21:51
  • so what is the workaround in the case? explicitly call $customer->load ? – Radu May 23 '19 at 16:15
  • $observer->getEvent()->getCustomer()->getData(); – Rk Rathod May 23 '19 at 18:12
  • this is not changing anything. I was asking if the workaround for getting the origData is to explicitly call $customer->load – Radu May 23 '19 at 22:43

Did you try one of the suggestions in the magento git issue report? Only reason I ask is because he seems so certain. I'm away from computer at the moment so can't test.

$customerData = $observer->getEvent()->getData('customer');
$newData = $customerData->getData('attriubute_code');
$previousData = $customerData->getOrigData('attribute_code')
  • not working. $previousData is null – Radu May 23 '19 at 12:59

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.