Skip to content
- Choosing a selection results in a full page refresh.
- Press the space key then arrow keys to make a selection.
------
document.addEventListener('DOMContentLoaded', function () {
const productScope = document.querySelector('#t-shirt-wit');
if (!productScope) return;
const imageMap = {
"The bride needs a Martini": "//uk.le-olive.com/cdn/shop/t/114/assets/the-bride-needs-a-martini.png?v=84887599166626198501774639457",
"It's giving wifey": "//uk.le-olive.com/cdn/shop/t/114/assets/its-giving-wifey.png?v=135660514831290687651774639458",
"Marriage Material": "//uk.le-olive.com/cdn/shop/t/114/assets/marriage-material.png?v=7789057331134516801774639457",
"The BRIDE Club": "//uk.le-olive.com/cdn/shop/t/114/assets/the-bride-club.png?v=40154548207120580631774639455"
};
const radioName = 'properties[Borduring op de borst (€9,95)]';
const chargeCheckbox = productScope.querySelector('.cb_1472893_915396');
const chargeHelper = productScope.querySelector('.cb_1472893_915396_helper');
function updateChargeState() {
const checkedRadio = productScope.querySelector('input[type="radio"][name="' + radioName + '"]:checked');
if (chargeCheckbox) {
chargeCheckbox.checked = !!checkedRadio;
chargeCheckbox.dispatchEvent(new Event('change', { bubbles: true }));
}
if (chargeHelper) {
chargeHelper.value = checkedRadio ? '✓' : '';
}
}
function updateActiveCards() {
const options = productScope.querySelectorAll('.bold_option.bold_option_radio .bold_option_value');
options.forEach(function (option) {
const input = option.querySelector('input[type="radio"][name="' + radioName + '"]');
option.classList.toggle('is-active', !!(input && input.checked));
});
}
function setupRadioImages() {
const radioOptions = productScope.querySelectorAll('.bold_option.bold_option_radio .bold_option_value');
radioOptions.forEach(function (option) {
const titleEl = option.querySelector('.bold_option_value_title');
const input = option.querySelector('input[type="radio"][name="' + radioName + '"]');
const label = option.querySelector('label');
if (!titleEl || !input || !label) return;
const title = titleEl.textContent.trim();
const imageUrl = imageMap[title];
option.classList.add('embroidery-radio-card');
if (imageUrl && !label.querySelector('.embroidery-radio-image-wrap')) {
label.insertAdjacentHTML(
'beforeend',
'' +
'
' +
''
);
}
input.addEventListener('change', function () {
updateActiveCards();
updateChargeState();
});
});
updateActiveCards();
updateChargeState();
}
setupRadioImages();
document.addEventListener('change', function (e) {
if (!productScope.contains(e.target)) return;
if (e.target.matches('input[type="radio"][name="' + radioName + '"]')) {
updateActiveCards();
updateChargeState();
}
});
});