Hi there – I’m trying to update the item before being added to the cart. I’ve followed the code outlined here but can’t get this to work with a checkbox.
Got this sorted. If anyone else is interested in this, here is the code:
<script>
const button = document.querySelector("#starry-night");
const checkbox = document.querySelector("#check-1");
// Update mounted panel checkbox selection
checkbox.addEventListener("change", () => {
// If checkbox is checked, set the value to 'true', otherwise 'false'
button.setAttribute(
"data-item-custom1-value",
checkbox.checked ? "true" : "false"
);
});
</script>