For persistent cart you need some way to identify the user that comes back. Both solutions below will keep the cart on project restart.
You can do that in several ways, simplest of which is to add the cart products into the table
CART
having columns
cart_id uniqueidentifier
product_id int
quantity
price
then you add/delete the products into that table and you save cart_id into
users Cookie[
^] - assuming he accepts them (most do).
Weakness is that Cookie is bound to that single device - if the user accesses your web shop through ...laptop or tablet instead of desktop computer, he has to start over. Also, if the user accepts the cookie from some public computer (say library of internet caffe computer) - next user to go to your site will have the cart filled.
It is your responsibility as a developer to delete the cookie after the cart is emptied and to set its duration to some reasonable lenght of time (I usually set it to two weeks.
Alternative and more demanding of the user is to force the user to register on your site before buying. That way, when he logs in, you can retrieve his cart and everything is personalized for that specific user. You can keep history of his shopping, follow his orders, amount he spent on your site, his preferences etc...
This is bothersome to users and you better have the content that can keep them engaged - you can do both cookies and this. To those who bother register you offer something extra to motivate them.