anonymous use

I have the below scenario, can someone advise the best approach to achieve that  online store application in which i have anonymous users, i need to let these users add products to the cart without registration and if they want to check out(buy) they have to register, should I save the cart list in a Non-Persistable entity then I will transfer these data after regist to the persistable entity
1 answers

Theoratically these are two options:

- first option: do it with a ‘offline first’-profile, so they can store it in their local database.

-  second option: do it in a non-persistant entity that you associate with their session.

Probably the second is the easiest to implement, since you do not have to change to the  profile