First important step: have the correct datamodel. Entity Cart and entity Article with a *-* association. Create a cart-object before or at the moment that your customer starts browsing. When she puts an article in the cart, associate the two.
Now you have the option to retrieve the selected articles for your customer.
Btw, the cart can be non-persistent if you don’t want to clean up the cart after the customer has ended her session. But most retailers keep the carts, then persistent is needed.