cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove the session cart once the cart is saved.

Former Member
0 Kudos

Hi All

I had a requirement to remove the session cart once the cart is saved for future. Is there any ootb strategy to remove the session cart once the cart is saved. Please let me know the recommended way to so.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gopi,

Please is below code meets your requirements:

 getSessionService().removeAttribute(DefaultCartService.SESSION_CART_PARAMETER_NAME);

Best Regards,

Former Member
0 Kudos

Hi

Thanks for the reply. We had an ootb method in cart facade to remove the session cart,but this method is removing the session cnd saved clso. My requirement was to remove the cfter successfully saved(Saved carts).

Answers (1)

Answers (1)

0 Kudos

if you do not want to use getSessionService().removeAttribute(DefaultCartService.SESSION_CART_PARAMETER_NAME); to remove cart from session you can create a new empty cart and set in session by using (de.hybris.platform.order.impl.DefaultCartService).setSessionCart() It will remove cart from session with out deleting.