1

I'm aware of the event emitted from CreatePost.php

$this->_eventManager->dispatch(
    'customer_register_success',
    ['account_controller' => $this, 'customer' => $customer]
);

but this is only for frontend new customer event, I have to find the best area to enter some code that runs only once when a new customer is created.

Edit: customer can be created thru frontend, API, admin page. And I need to catch all.

Edit 2: I'm trying to find the last event when a customer is created or edited, I have to run a reindex command after.

Thanks in advance.

1
  • Saveafter observer is good for you. Commented Jan 25, 2018 at 2:16

1 Answer 1

1

Frontend, Admin, API, we should use Plugin for : \Magento\Customer\Model\AccountManagement::createAccount()

3
  • Wouldn't that get me the "before" call, where the model hasn't been created yet?
    – Mac A.
    Commented Jan 25, 2018 at 17:22
  • Actually I don’t know your purpose. I just gave you a suggestion. Can you update your question more details? Commented Jan 26, 2018 at 0:25
  • One of the 3rd party extensions that I have, has some custom attributes on customer model, and it's forcing me to run a reindex on new customers, and everytime a customer group is changed, I've already tried update on save also, I still need to reindex customer grid every time.
    – Mac A.
    Commented Jan 27, 2018 at 0:45

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.