Dynamically select Product.Ids

Christopher99
Excursionist
18 0 5

Hello everybody,

I am trying to build a configurator and experimenting with arrays and product.ids
I want to add the product id to the array when I press the button "Try it". 
The problem right now is, that the same product id is selected everytime.
Do you have any idea on how to fix this ?

https://boxifique.com/pages/configurator-layers

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>
    
<script>
  var fruits = ["ID:"];
    document.getElementById("demo").innerHTML = fruits;

    function myFunction() {
      fruits.push({{ product.id }});
      document.getElementById("demo").innerHTML = fruits;
	} 
</script>

Have a good one!

0 Likes