dropdown for product variant picker
parent
f9c9287ceb
commit
baedde8a14
|
@ -200,6 +200,20 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Set the initial value when the page loads
|
||||
window.addEventListener('load', function() {
|
||||
const selectedValue = selectElement.value;
|
||||
selectedButton.innerText = selectedValue;
|
||||
|
||||
document.querySelectorAll('.shx-custom-dropdown-content div').forEach(div => {
|
||||
if (div.getAttribute('data-value') === selectedValue) {
|
||||
div.classList.add('shx-custom-selected-variant');
|
||||
} else {
|
||||
div.classList.remove('shx-custom-selected-variant');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{%- if picker_type == 'swatch' -%}
|
||||
|
|
Loading…
Reference in New Issue