0

After login redirect user on previous page from front-end.

I am using the login pop-up and all default functionality. Also the Admin configuration Redirect Customer to Account is set as No. But it redirect me on Customer Dashboard.

8

We can config in Admin: STORES > Configuration > CUSTOMERS > Customer Configuration > Login Options > Redirect Customer to Account Dashboard after Logging in > No.

enter image description here

When enabled this config, the login url will have a referer param to base64 encode url, like: http://{website_url}/customer/account/login/referer/aHR0cDovL2xvY2FsaG9zdC9tYWdlMjE=/

Technically, we should take a look:

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

 public function execute()
 {
        ......
        return $this->accountRedirect->getRedirect();
 }

vendor/magento/module-customer/Model/Account/Redirect.php

/**
 * Retrieve redirect
 *
 * @return ResultRedirect|ResultForward
 */
public function getRedirect()
{
     ......
}

UPDATE: Please delete your local storage, this feature will work well. Please read more here.

Magento Version:

-Magento version 2.1.0

  • 1
    I already set this to NO. But its not working for me. – Ashish Jagnani Aug 12 '16 at 10:50
  • You choose correct store view or any customized? – Khoa TruongDinh Aug 12 '16 at 10:53
  • I already checked all these setting and all are proper. If you have any idea which methods is responsible for this setting for redirect so that I can check there for the value of this setting ? – Ashish Jagnani Aug 12 '16 at 10:55
  • I updated some useful methods. You should take a look. – Khoa TruongDinh Aug 13 '16 at 11:32
  • When I enable the guest checkout its working fine. Is it possible to set this only for customer ? – Ashish Jagnani Aug 16 '16 at 6:04
3

Set config setting in Admin:

STORES > Configuration > CUSTOMERS > Customer Configuration > Login Options > Redirect Customer to Account Dashboard after Logging in > No.

Also we have to enable Guest checkout.

  • Not working, still have the referer link.... – Frank Groot Jul 26 '18 at 13:19
  • No need to enable Guest Checkout. Just flush the cache properly and maybe browser cache as well. – Abid Malik Aug 28 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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