I need to add some custom logic in my extension after Editing Account Information, It should not trigger at Change Password or Edit Address.

Will customer_account_edited work.

        ['email' => $customerCandidateDataObject->getEmail()]

1 Answer 1


Yes, You can use it (will work). Magento 2 event "customer_account_edited" is official/legal event name.

In Your module add this event into your events.xml file. For example: VendorName/ModuleName/etx/frontend/events.xml

 <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_account_edited">
        <observer name="VendorModuleEditAccount" instance="VendorName\ModuleName\Observer\EditCustomer"/>

Then create needed file EditCustomer.php which gets data from observer. For example: VendorName/ModuleName/Observer/EditCustomer.php


declare (strict_types = 1);

namespace VendorName\ModuleName\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class EditCustomer implements ObserverInterface

    private $logger;

    public function __construct(
        \Psr\Log\LoggerInterface $logger
    ) {
        $this->logger = $logger;

    public function execute(Observer $observer)
       try {
            $editedCustomerEmail = $observer->getEvent()->getEmail();
         } catch (\Exception $e) {
             $this->logger->critical('Error message', ['exception' => $e]);


Upgrade Your modules and clear cache with commands in terminal:

php bin/magento setup:upgrade

php bin/magento cache:clean

Go to frontend, login or create new account. Edit account. Go to /var/log/info.log There You'll see "[email protected] [] []"

Please note that there is no point to print "$observer->getEvent()->getCustomer()", cause observer not output all customer info after "customer_account_edited" event. It only outputs email address (that's why I logged only email address). If You'll print out all $observer You'll get

object(Magento\Framework\Event\Observer)#1529 (1) { ["_data":protected]=> array(2) { ["event"]=> object(Magento\Framework\Event)#1398 (2) { ["_observers":protected]=> object(Magento\Framework\Event\Observer\Collection)#1575 (1) { ["_observers":protected]=> array(0) { } } ["_data":protected]=> array(2) { ["email"]=> string(18) "[email protected]" ["name"]=> string(23) "customer_account_edited" } } ["email"]=> string(18) "[email protected]" } }

Tested with Magento 2.3.0

  • But it is not working in 2.3.5
    – Sabareesh
    Jun 26, 2020 at 14:26

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.