Here it is in jsfiddle:
Add cart not working - JSFiddle[
^]
But it works as expected.
I made a couple of changes just to get it to run, such as populating the elements on doc.ready, just to get it to fit with jsfiddle.
I also made the functions arrow functions.
I guess I don't get when you load the script? Maybe by the time it runs the document hasn't finished loading all the elements?
Try looking at jQuery. It works great with ES6. Instead of looking for the element you can set selectors, which act as pointers to elements that match. It's a much more consistent way of getting hold of your elements. Here, look:
let id = document.getElementById("productID")
id = $("productID")