6

I need to add some custom logic in my extension after

  1. Edit Account Information
  2. Change Password
  3. Edit Address

The customer_save_after_data_object event can be used for case 1. How about 2 & 3?

3

You can use below events for 3rd point.

Edit Address

customer_address_save_after

<event name="customer_address_save_after">
    <observer name="customer_addres_after_save_viv_observer" instance="Magento\Customer\Observer\AfterAddressSaveObserver" />
</event>

or

customer_address_save_before

<event name="customer_address_save_before">
    <observer name="customer_address_before_save_viv_observer" instance="Magento\Customer\Observer\BeforeAddressSaveObserver" />
</event>

Hope this helps.

  • how can I get the address object in the observer? – Paul Aug 25 '16 at 13:05
  • 1
    $customerAddress = $observer->getCustomerAddress(); refer Magento\Customer\Observer\AfterAddressSaveObserver for more info. – Krishna ijjada Aug 25 '16 at 14:16
  • how to distinguish whether the address is a billing address or a shipping address? – Paul Aug 31 '16 at 9:07
  • can we use this event for customer account info edit? "customer_account_edited" – jafar pinjar Oct 23 '18 at 13:25
  • It is good to know that the event is fired only when the data is changed. – István Döbrentei Apr 2 '19 at 16:58
3

For 2, you can use the same event as 1: customer_save_after_data_object

For 3, you can use the customer_address_save_after event

  • How to get customer street after using that event? – jafar pinjar Sep 3 '18 at 11:13
  • customer_save_after_data_object is not firing when the account info is asaved – jafar pinjar Nov 23 '18 at 13:37
  • How can get customer object in observer file? – jafar pinjar Nov 23 '18 at 13:42

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.