on ‎2018 Mar 02 2:10 PM
Scenario: a user is logged in in hybris (soft or hard login, doesn't matter) and has some items in cart.
They go to the register page, register as a new user and are automatically logged in. At this moment cart merge happens and:
the new user gets all the cart items from the old user
old user (if you relogin with them) gets an empty cart
What I would like is the opposite: save the cart for the old user and have the new user get a new fresh cart.
I found that calling DefaultCartService::removeSessionCart() solves the problem with having a new empty cart but it also erases the cart for the old user.
How can I reliably save the cart for the old user and then erase it from session?
Or in other words - how can I force-logout the user in the middle of the registration process but without doing any redirects?
Request clarification before answering.
Just a short update: my current solution is use this line from de.hybris.platform.order.impl.DefaultCartService:
getSessionService().removeAttribute(SESSION_CART_PARAMETER_NAME);
Removing the attribute from the session forces creation of a new empty cnd the old one stays saved for the old user.
Pretty sure there is a better solution, but this one solves the problem at least.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.