How to redirect the customer to the signin/signup page if not logged in before proceeding to checkout?

  • 1
    Good to hear that you have resolved this :) – Shoaib Munir Jul 23 '19 at 7:21

Magento has an option for logged in based checkout

Store -> Configuration -> Sales -> Checkout

In Checkout Options you need to select Allow Guest Checkout to "No"

This will show a login popup on cart page if the customer is not logged in. It is better than redirecting the user to the login page.


If you still want to redirect the user to login page before checkout Goto


Then in the top of the file use this:

    //Redirect to login page if customer is not logged in
    if(!$this->customerSession->isLoggedIn()) {
  • Let me update my answer then – Shoaib Munir Jul 23 '19 at 5:45
  • Please checkout updated answer – Shoaib Munir Jul 23 '19 at 5:49
  • I don't know exactly the path for checkout controller, let me search on google, will share if I get anything – Shoaib Munir Jul 23 '19 at 6:08
  • I have edited your answer without your permission. dont mind – Teja Bhagavan Kollepara Jul 23 '19 at 7:22
  • 1
    That's ok, it would help others in future :) – Shoaib Munir Jul 23 '19 at 7:23

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.