Just as an aside. You can’t have the same id more than once. So querySelectorAll and an id don’t make sense. The JS will work as far as I know, but it’s invalid HTML.
You can add the defer attribute to the script tag, or wrap your code in a DOMContentLoaded handler, or just put the script element before the closing body tag. But if elements are dynamically added (like in a cart for example) you have to make sure you query for them at the right time and not just when the document loads.
I would suggest not using the DOM as data storage.
It’s fine to display data, but using the DOM as live storage (adding/updating/retrieving) of data directly, isn’t really a good idea. It is in my opinion a potential bad mental model to get into. Because that is not how it would normally work. You would be getting the products and their data from some back-end and in my opinion, it’s better to get in the habit of thinking of DOM content, like products, as external data. The same goes for other such learning projects, like say a todo list.
You do not need a real back-end or database for this. You can just create an array of objects or use a JSON file for the data. Then have the DOM reflect that data. This means you update the data and the DOM will just render it. Making the DOM content just a view representation of data.