2

How can we disable auto login of customer on registration in magento 2?

On creating new account, customer is created with auto login. How can we disable auto login, so that customer can only register later he can login with details to login?

like that option available by default? Or that can be done pro grammatically?

1 Answer 1

3

Override this below class:

/vendor/magento/module-customer/Controller/Account/CreatePost.php

and find the below line:

$this->session->setCustomerDataAsLoggedIn($customer);

which set customer as logged in. You can comment this line or add your logic.

1
  • 1
    yes, Its working!!! Aug 27, 2018 at 14:14

Your Answer

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

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