Terms & Conditions Checkbox
<div class="terms-container">
<label class="checkbox-wrapper">
<input type="checkbox" id="terms-checkbox" checked="">
<t5 class="checkbox-text">I agree to the terms and conditions.</t5>
</label>
</div>const termsCheckbox = document.getElementById('terms-checkbox');
function handleError(title, error) {
Superfans.actions.showAlert({
title,
message: error?.message || "An unexpected error occurred. Please try again.",
});
}
async function toggleCheckout(enable) {
try {
const action = enable
? Superfans.actions.enableCheckoutButton
: Superfans.actions.disableCheckoutButton;
await action();
} catch (error) {
handleError(enable ? "Error enabling checkout" : "Error disabling checkout", error);
}
}
async function initializeCheckout() {
try {
termsCheckbox.checked = true;
await Superfans.actions.enableCheckoutButton();
} catch (error) {
handleError("Error enabling checkout on load", error);
}
}
termsCheckbox.addEventListener("change", () => {
toggleCheckout(termsCheckbox.checked);
});
initializeCheckout();Updated about 1 month ago
Did this page help you?