I need to send an email after a customer try to save a new address in his address book
2 Answers
You can use below events for customer address.
<event name="customer_address_save_after">
<observer name="customer_addres_after_save_event_observer" instance="Vendor\Extension\Observer\AfterAddressSaveObserver" />
</event>
OR
<event name="customer_address_save_before">
<observer name="customer_address_before_save_event_observer" instance="Vendor\Extension\Observer\BeforeAddressSaveObserver" />
</event>
-
Could you please explain where to put this code, Thank you for your answer– sara benCommented Nov 3, 2021 at 11:09
-
You need to create events.xml into extension and put the code there. Commented Nov 6, 2021 at 17:37
You should create etc/frontend/events.xml
file in your module and post there event from Dhiren Vasoya comment. Then create the class Vendor\Extension\Observer\BeforeAddressSaveObserver
OR Vendor\Extension\Observer\BeforeAddressSaveObserver
depending on your event name and send email inside the class. You can google a little and find the way how to send email with custom template and parameters.