cancel
Showing results for 
Search instead for 
Did you mean: 

Observer event to check customer login on checkout page

SOLVED

Observer event to check customer login on checkout page

I  have created observer that will be fired after customer will login and update the price of the added to cart.

 

Now thing is when i try to login on checkout page it doesn't fire.  it works for default login page. but on checkout page it doesn't work.  

 

I have used following event to fire my observer code:

 

 <event name="customer_login">
        <observer name="customer_login_observer" instance="Customergroup\Updategroup\Observer\CustomerLogin" />
    </event>

this event is not working when i login on chekout page.

 

How can i check if customer is logged in then update the cart item on checkout page?

 

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Observer event to check customer login on checkout page

You can use below event for checkout customer login page,

 

<event name="controller_action_postdispatch_customer_ajax_login">

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

6 REPLIES 6

Re: Observer event to check customer login on checkout page

You can use below event for checkout customer login page,

 

<event name="controller_action_postdispatch_customer_ajax_login">

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Observer event to check customer login on checkout page

Thanks Rakesh bhai.  How did you check that event?  I mean how did you get to know that event is use by that?    I am new to m2 so that would help me..

 

 

Re: Observer event to check customer login on checkout page

When you check in checkout page email login, after valid email and password on checkout press on login button they will call one request customer/ajax/login. so based on that request we can set pre or post dispatch request for any magento event.

If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: Observer event to check customer login on checkout page

Hello,

 

<event name="controller_action_postdispatch_customer_ajax_login">

 

you can make any controller  postdispatch and predispatch of any event .

e.g your controller name is test_test_index

 

you can make event like

<event name="controller_action_postdispatch_test_test_index">

same for predispatch

 

<event name="controller_action_predispatch_customer_ajax_login">


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Observer event to check customer login on checkout page

Appreciate your reply.  it helped me to understand the predispatch and postdispatch.

Re: Observer event to check customer login on checkout page

Magento 2.3 Customer Login event can be instantiated using,

<event name="customer_login">
<observer name="vendor_module_some_event_name_that_makes_sense" instance="VendorName\ModuleName\Observer\DirPath\ToYour\Logic\FileObserver" />
</event>