1

Authentication popup is the login popup that will appear if customer who are not logged in press Proceed to Checkout button in cart page.

For default, when customer sign in using authentication popup they will be redirected to the previous page (cart page).

I want to modify the redirect url after customer sign in from authentication pop up, they'll redirected to custom page. I have trying to locate the form action in Magento_Customer/view/frontend/web/js/view/authentication-popup.js but i can't find it.

1 Answer 1

1

Your path should be : app/design/frontend/Vendor/Theme/Magento_Customer/web/js/view/authentication-popup.js

For the simple way, we can set the redirect url in our custom js - authentication-popup.js:

        /** Provide login action */
        login: function (loginForm) {

          ...... 
                this.isLoading(true);
                loginAction(loginData, null, false); // We can set the redirect here
          ......
        }

Take the look the loginAction method - Magento_Customer/js/action/login.

                   if (redirectUrl) {
                        window.location.href = redirectUrl;
                    } else if (response.redirectUrl) {
                        window.location.href = response.redirectUrl;
                    } else {
                        location.reload();
                    }

As we can see, if we set the redirect url by default, Magento site will use it for redirecting.

For the redirect Url, we can read more here: https://magento.stackexchange.com/a/131227/33057

10
  • yes, i have created authentication-popup.js in that directory. now i want to change the redirect url after customer login.
    – Seventh St
    Commented Feb 10, 2017 at 16:18
  • Which the redirect url you want after customer login? Commented Feb 10, 2017 at 16:20
  • to checkout page.
    – Seventh St
    Commented Feb 10, 2017 at 16:24
  • You should read more here: magento.stackexchange.com/a/131227/33057 Commented Feb 10, 2017 at 16:25
  • 1
    @KhoaTruongDinh I don't think modifying code library is good Idea... We should use mixin to achieve this Commented Sep 26, 2017 at 12:21

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.