8

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?

2 Answers 2

4

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.

6
  • how can I get the address object in the observer?
    – TFS
    Aug 25, 2016 at 13:05
  • 1
    $customerAddress = $observer->getCustomerAddress(); refer Magento\Customer\Observer\AfterAddressSaveObserver for more info. Aug 25, 2016 at 14:16
  • how to distinguish whether the address is a billing address or a shipping address?
    – TFS
    Aug 31, 2016 at 9:07
  • can we use this event for customer account info edit? "customer_account_edited" Oct 23, 2018 at 13:25
  • It is good to know that the event is fired only when the data is changed. Apr 2, 2019 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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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