Showing the single result
-

A convenient drink mix combining fiber, B vitamins, enzymes and an unusually diverse blend of botanicals
#lwf-truecleanse-form select.lwf-select {
appearance: auto !important;
-webkit-appearance: menulist !important;
background-image: none !important;
cursor: pointer;
}
#lwf-truecleanse-form .lwf-add-to-cart {
background: #164421 !important;
color: #ffffff !important;
font-family: "Work Sans", sans-serif !important;
font-weight: 500 !important;
text-transform: uppercase !important;
border-radius: 2px !important;
cursor: pointer;
}
(function () {
const formBox = document.getElementById("lwf-truecleanse-form");
if (!formBox) return;
const form = formBox.querySelector("form");
const packageSelect = formBox.querySelector("#truecleanse-package");
const productPriceField = formBox.querySelector("#truecleanse-productpr");
const priceDisplay = formBox.querySelector("#truecleanse-price");
const addToCartButton = formBox.querySelector("#truecleanse-add-to-cart");
const deliveryInputs = formBox.querySelectorAll('input[name="truecleanse-delivery"]');
const productName = "TrueCleanse";
const packages = {
one: {
sku: "TL006PROD",
description: "(1) box / 10 stick packets",
price: "59.95"
},
two: {
sku: "TL006PROD",
description: "(2) boxes / 10 stick packets each",
price: "119.90"
},
three: {
sku: "TL006PROD",
description: "(3) boxes / 10 stick packets each",
price: "179.85"
},
four: {
sku: "TL006PROD",
description: "(4) boxes / 10 stick packets each",
price: "239.80"
}
};
function selectedDelivery() {
const selected = formBox.querySelector('input[name="truecleanse-delivery"]:checked');
return selected ? selected.value : "";
}
function deliveryDescription(delivery) {
if (delivery === "monthly") return "autoship monthly";
if (delivery === "two-months") return "autoship every 2 months";
return "one-time purchase";
}
function updateSelection() {
const selectedPackage = packages[packageSelect.value];
if (!selectedPackage) {
productPriceField.value = "";
priceDisplay.textContent = "(Price will show when you make your selection)";
priceDisplay.classList.add("lwf-price-prompt");
addToCartButton.disabled = true;
return;
}
const description = productName + ", " + selectedPackage.description +
", SKU " + selectedPackage.sku + ", " +
deliveryDescription(selectedDelivery());
productPriceField.value = description + ", :" + selectedPackage.price;
priceDisplay.textContent = "$" + Number(selectedPackage.price).toLocaleString("en-US", {
minimumFractionDigits: 2,
maximumFractionDigits: 2
});
priceDisplay.classList.remove("lwf-price-prompt");
addToCartButton.disabled = false;
addToCartButton.textContent = "ADD TO CART →";
}
deliveryInputs.forEach(function (input) {
input.addEventListener("change", updateSelection);
});
packageSelect.addEventListener("change", updateSelection);
form.addEventListener("submit", function (event) {
updateSelection();
if (!productPriceField.value) event.preventDefault();
});
updateSelection();
})();