Page 1 of 1

Make login require for checkout the order

Posted: 17 May 2019, 13:23
by Dhara1510
I want a user to login before checkout the order.

Current scenario: User can add product to cart and do checkout without login

Required scenario: User can add product to cart. User has to login when he want to do checkout. When user click on it should redirect user to login page.

How can it be done? Can you please guide me?

Re: Make login require for checkout the order

Posted: 17 May 2019, 16:05
by AnthonyLim
Not exactly what you ask for, but what I did was to make the user login even before shopping. It's pretty easy; just edit config/shop.php and configure the "routes" like so:

Code: Select all

'routes' => [
      'default' => ['prefix' => 'shop', 'middleware' => ['web','auth']],
],

Re: Make login require for checkout the order

Posted: 20 May 2019, 05:59
by Dhara1510
Thanks. I have overridden routes and applied "auth" middleware to checkout controller and it works :)