Skip to content
document.addEventListener('DOMContentLoaded', function() {
const productJson = document.querySelectorAll('[data-product-json]');
if (productJson.length > 0) {
for (let i = 0; i < productJson.length; i++) {
const current = productJson[i];
const section = current.closest('[data-section-id]');
const currentJson = JSON.parse(current.text);
const selectedColor = 'Black'; // Set your default color here
if (currentJson.options.length > 0) {
const colorOptions = section.querySelectorAll('.single-option-selector');
colorOptions.forEach((select, index) => {
const options = select.querySelectorAll('option');
options.forEach(option => {
if (option.text !== selectedColor) {
option.setAttribute('disabled', 'disabled');
} else {
option.removeAttribute('disabled');
}
});
});
}
}
}
});