You are going in the right direction. Shopping Cart is a kind of application which includes all the basic stuffs to learn and explore.
As you said, making use of JavaScript Cookies is an appropriate option. But also, there is another storage mechanism - localStorage, in JavaScript. Using this, you need not to worry about the browser cookies cleared by the users. For more details please refer to the site -
jstorage
Have a happy coding !!!
Regards,
Niral Soni