Shopping Cart Tutorial

How can I Save my shopping cart data in the local storage and also make the cart’s quantity increment and versa when I add or remove a product.

Thanks…

With no code and no implementation details, we can’t give you any specific answer. If you have some code you can link to it would help.

https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API

You need to take a more data-driven approach.

Don’t use the DOM for state, make it reflect state. Create something like an array of objects and use that for the state. The state data can be saved to localStorage. Your DOM methods will use the state to update the DOM.

If you look at some Todo list tutorials that use a data structure and localStorage you will get most of the information you need for this.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.