For some reason, magento clears session or customer session data after redirect? How will I save some data before it redirect to the next page into a session?

I tried adding session_write_close(); but this doesn't help.


Some actions do not retrieve Magento::getSingleton('core/session') whole data.

  • This then means your customer gets logged out after the redirect, which would be poor user experience. Rather than doing a workaround, saving the session data, it would be best to figure out why the session is clearing. Is there, by any chance, a 404 happening in the redirect (not the redirect itself, but some resource (be it image/css/js) on the redirected location? See this post: magento.stackexchange.com/questions/385/… - it may contain some helpful information
    – ProxiBlue
    Apr 25, 2015 at 23:44

1 Answer 1


If session not totaly clears, you can try this:

$session = Mage::getSingleton("core/session",  array("name"=>"frontend"));  //load session variables
$session->setData("data", $data); //save your data in custom session variable

And then, when you need this data:

$data = $session->getData("data"); //get data from custom variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.