SOFTLOFT / Blog  / Magento Customer Session is empty

Magento Customer Session is empty

Some Magento developers have been challenges that the user session does not contain data.

The most common problems:

  • user can not log in to the store;
  • user’s comment comes as from guest;
  • do not load user data for forms.

The issue is often difficult to diagnose and accordingly the cause of its occurrence is not always obvious, although this can be solved quite quickly.

List of events that will help you navigate in the search for the right function:

  • controller_front_init_before
  • controller_front_init_routers
  • adminhtml_controller_action_predispatch_start

You need to find all the entry points for these events, usually this is Obsever / Controller and see if there is usage of the sessions. To more accurately determine whether this function is a problem, you can comment out its contents.

As an alternative to sessions, you can use cookies. If information is required to be stored (for example for security reasons) only in a session, it is recommended to use other events.