2

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

However (customer/session) still persisting the data.

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

What is the ideal way to achieve it?

0

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.

$customerSession->unset()
$customerSession->clear()
$customerSession->unsetAll()

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.