PROFESIONALNI SET
SLOZI SVOJ RITUAL
77,00 € €
68,00 €
UKLJUČENO
BOND SEAL TOP COAT
ODABERI BOND BUILDER GEL
Odaberi 1
ODABRANO:
Bond builder classic echo
77,00 € €
68,00 €
Uštedi 9 €
Popust se automatski primjenjuje u košarici.
document.addEventListener('click', function(event) {
const gelButton = event.target.closest('[data-gel-button]');
if (gelButton) {
const section = gelButton.closest('.esola-ritual-template--30701352616267__starter_set_YihbpH');
if (!section) return;
const allGelButtons = section.querySelectorAll('[data-gel-button]');
const selectedName = section.querySelector('[data-selected-name]');
const selectedSwatch = section.querySelector('[data-selected-swatch]');
allGelButtons.forEach(function(item) {
item.classList.remove('is-selected');
});
gelButton.classList.add('is-selected');
if (selectedName) {
selectedName.textContent = gelButton.dataset.gelName || '';
}
if (selectedSwatch) {
const color = gelButton.dataset.swatchColor || '#E7B8AD';
const image = gelButton.dataset.swatchImage || '';
selectedSwatch.style.backgroundColor = color;
if (image) {
selectedSwatch.style.backgroundImage = 'url("' + image + '")';
} else {
selectedSwatch.style.backgroundImage = 'none';
}
}
return;
}
const addButton = event.target.closest('[data-add-bundle]');
if (addButton) {
const section = addButton.closest('.esola-ritual-template--30701352616267__starter_set_YihbpH');
if (!section) return;
const selectedGel = section.querySelector('[data-gel-button].is-selected');
const buttonText = addButton.querySelector('[data-button-text]');
const topVariantId = (addButton.dataset.topVariantId || '').trim();
const baseVariantId = (addButton.dataset.baseVariantId || '').trim();
const gelVariantId = selectedGel ? (selectedGel.dataset.variantId || '').trim() : '';
const gelName = selectedGel ? (selectedGel.dataset.gelName || '') : '';
if (!topVariantId || !baseVariantId || !gelVariantId) {
alert('Upiši Variant ID za Bond Seal Top Coat, Tanax Base i odabrani gel.');
return;
}
const originalText = buttonText ? buttonText.textContent : '';
const bundleId = 'esola-starter-' + Date.now();
addButton.disabled = true;
if (buttonText) {
buttonText.textContent = 'DODAJEM...';
}
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
items: [
{
id: Number(topVariantId),
quantity: 1,
properties: {
'_bundle_id': bundleId,
'Set': 'ESOLA Starter Ritual'
}
},
{
id: Number(baseVariantId),
quantity: 1,
properties: {
'_bundle_id': bundleId,
'Set': 'ESOLA Starter Ritual'
}
},
{
id: Number(gelVariantId),
quantity: 1,
properties: {
'_bundle_id': bundleId,
'Set': 'ESOLA Starter Ritual',
'Odabrani gel': gelName
}
}
]
})
})
.then(function(response) {
return response.json().then(function(data) {
if (!response.ok) {
throw data;
}
return data;
});
})
.then(function() {
if (buttonText) {
buttonText.textContent = 'DODANO';
}
window.location.href = '/cart';
})
.catch(function(error) {
console.log(error);
addButton.disabled = false;
if (buttonText) {
buttonText.textContent = originalText;
}
alert('Došlo je do greške. Provjeri jesu li Variant ID-jevi točni i jesu li proizvodi dostupni.');
});
}
});