In My Hub
In My Hub
// Configuration for Pineal Guardian Offers
const bumpPrice = 19.00;
// Elements
const bumpToggle = document.getElementById('order-bump-toggle');
const subtotalDisplay = document.getElementById('base-price-display');
const shippingDisplay = document.getElementById('shipping-display');
const totalDisplay = document.getElementById('total-display');
const productNameDisplay = document.getElementById('product-name');
const packageRadios = document.getElementsByName('package');
const formatCurrency = (amount) => '$' + amount.toFixed(2);
function updateTotal() {
let selectedPrice = 0;
let shippingCost = 0;
let selectedName = "";
// 1. Get Selected Package (Radio)
for (const radio of packageRadios) {
if (radio.checked) {
selectedPrice = parseFloat(radio.value);
shippingCost = parseFloat(radio.getAttribute('data-shipping'));
// Update Text based on selection
if (radio.value === "234") selectedName = "Pineal Guardian X (6 Bottles)";
else if (radio.value === "236") selectedName = "Pineal Guardian X (4 Bottles)";
else selectedName = "Pineal Guardian X (2 Bottles)";
break; // Stop loop once found
}
}
// 2. Update Subtotal & Shipping Text
productNameDisplay.textContent = selectedName;
subtotalDisplay.textContent = formatCurrency(selectedPrice);
if (shippingCost === 0) {
shippingDisplay.textContent = "FREE";
shippingDisplay.style.color = "#27ae60"; // Green for free
} else {
shippingDisplay.textContent = formatCurrency(shippingCost);
shippingDisplay.style.color = "#333";
}
// 3. Add Bump if Checked
let finalTotal = selectedPrice + shippingCost;
if (bumpToggle.checked) {
finalTotal += bumpPrice;
}
// 4. Update Final Total
totalDisplay.textContent = formatCurrency(finalTotal);
// Visual Pop Effect
totalDisplay.style.transform = "scale(1.05)";
setTimeout(() => totalDisplay.style.transform = "scale(1)", 200);
}
// Initialize
updateTotal();
WE'RE GOING LIVE IN...
WE'RE GOING LIVE IN...
00
days
days
00
hours
hours
00
minutes
minutes
00
seconds
seconds
Live Chat
0 Currently Online
Log in to Live Chat!