I found this file /vendor/magento/module-customer/Controller/Account/LoginPost.php file is having some code. What is the explanation of below code?

magento.stackexchange https://magento.stackexchange.com/questions/335320

Question

I want to know what actually these two lines of code are doing.

    $redirectUrl = $this->accountRedirect->getRedirectCookie();
    if (!$this->getScopeConfig()->getValue('customer/startup/redirect_dashboard') && $redirectUrl) {
Was it helpful?

Solution

The code above will Magento (after passing the conditions) to redirect the customer to the route saved in the redirect cookie after successful login if the configuration which says that all customers be redirected to their accounts' dashboard instead Stores -> Configuration -> Customers -> Login Options -> Redirect Customer to Account Dashboard after Logging in is not enabled.

See class vendor/magento/module-customer/Model/Account/Redirect.php for more details on how the redirect route is used.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top