I am using the Magento customer session to store some data. I want it to be destroyed when a customer logs out.

However (customer/session) still persisting the data.

One way is I can unset data on the log-out observer. But does it automatically clear all the customer session data when the user logs out?

What is the ideal way to achieve it?


These are your options, they do all the same, clearing all data on the session. But when the customer logs out, there is no way to retrieve the data, because the session is destroyed.


Calling one of the methods on logout event customer_logout is a good idea.

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.