I have created a custom module, and added event in etc/events.xml as below :

<?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_create">
        <observer name="customizecustomer_accountcreate" instance="Module\Custom\Model\Accountcreate" shared="false" />

And created a file Model/Accountcreate.php as below :

namespace Module\Custom\Model;

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

class Accountcreate implements ObserverInterface

    public function execute(Observer $observer)
        $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/customer.log');
        $logger = new \Zend\Log\Logger();
        $logger->info('Accountcreate'); // to check if event is working or not


Also executed below commands :

php bin/magento cache:clean
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

But when I'm trying to register as customer the event is not calling.

I want to add some server side validation on customer account create.

Am I doing anything wrong? Is there any another event which trigger before account create?

  • Check my answer it will help you. Commented May 22, 2018 at 5:38

2 Answers 2


There is no event customer_account_create

You can use customer_register_success for customer register success.

You can see all the event list here.


You can use this event for validation.


Magento is using this event for validating captcha.

  • I want to add some custom validation before customer account create with the data what customer enter, and don't allow to register if validation failed. Commented May 22, 2018 at 5:43
  • @VinayaMaheshwari You can create your one custom event. Commented May 22, 2018 at 5:57
  • @VinayaMaheshwari check my updated answer. Commented May 22, 2018 at 6:03
  • I have added controller_action_predispatch_customer_account_createpost and also validation on form fields but how to throw exception if validation failed? Commented May 22, 2018 at 6:45

Instead of overriding, you can create a custom plugin (the new concept introduced in Magento 2).

Ref. Links:

Benefits of using plugins instead of overriding functions:

  • “Listen” to any method call made on an object manager controlled object and take programmatic action
  • Change the return value of any method call made on an object manager controlled object
  • Change the arguments of any method call made to an object manager controlled object

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.