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.
Solved! Go to Solution.
You can use below event for checkout customer login page,
<event name="controller_action_postdispatch_customer_ajax_login">
You can use below event for checkout customer login page,
<event name="controller_action_postdispatch_customer_ajax_login">
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..
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.
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">
Appreciate your reply. it helped me to understand the predispatch and postdispatch.
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>