Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Product Title
15.99$19.99$

Dein Weinpaket

Füge 6 Weine hinzu und erhalte 10% Rabatt

0

/

0

Noch 0 Weine bis dein Paket komplett ist!
Product Title
1 x
16.99$

Füge Produkte hinzu, indem du auf das + Symbol klickst

Gesamt
19.99$16.99$
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
document.addEventListener("DOMContentLoaded", function() { function attachChfLogic(chfId, totalId, textId, switchId) { const chfSpan = document.getElementById(chfId); const totalSpan = document.getElementById(totalId); const normalText = document.getElementById(textId); const switchText = document.getElementById(switchId); if (!chfSpan || !totalSpan || !normalText || !switchText) return; function updateChfValue() { const totalValue = parseFloat(totalSpan.textContent.replace(/[^\d.]/g, "")) || 0; let newChfValue = 250 - totalValue; if (newChfValue < 0) newChfValue = 0; chfSpan.textContent = newChfValue.toFixed(2); // Toggle text visibility if (totalValue >= 250) { normalText.style.display = "none"; switchText.style.display = "block"; } else { normalText.style.display = "block"; switchText.style.display = "none"; } console.log(`[${chfId}] total=${totalValue} -> chf=${newChfValue}`); } updateChfValue(); const observer = new MutationObserver(updateChfValue); observer.observe(totalSpan, { childList: true, characterData: true, subtree: true }); } // Proveri screen širinu if (window.innerWidth > 768) { // Desktop attachChfLogic("chf-span", "total-span", "shipping-text", "shipping-text-switch"); } else { // Telefon attachChfLogic("chf-span-1", "total-span-1", "shipping-text-1", "shipping-text-1-switch"); } });