Hola, ¿cómo puedo obtener una identificación de producto y configurarla en la solución de recuperación en el campo de identificación: 'id':
¿Cuál sería el código para insertar en esa área?
$("#purchase").click(function(){ var addData = { 'id':, /* ID Variant */ 'quantity':1 }; fetch('/cart/add.js', { body: JSON.stringify(addData), credentials: 'same-origin', headers: { 'Content-Type': 'application/json', 'X-Requested-With':'xmlhttprequest', }, method: 'POST' }).then(function(response) { return response.json(); }).then(function(json) { /* we have JSON */ console.log(json) }).catch(function(err) { /* uh oh, we have error. */ console.error(err) }); });debe agregar el Atributo con el nombre variant-id al botón #purchase que no necesita para product_id para agregar el artículo al carrito y obtener la variante id por document.getElementById('purchase').getAttribute("variant-id ");
y en el botón #purchase <button id='purchase' variant-id={{variant.id}} >