Developer Hooks
JavaScript Events
Checkout Countdown will trigger JavaScript events depending on the status of the countdown timer.
- ccfwooReachedZero – Triggers when the countdown is zero but may not be finished. At this point the countdown could loop if you have enabled the looping feature in Checkout Countdown Pro.
- ccfwooFinishedCounting – The countdown has completely finished and the “countdown expired” message will be displayed at this event.
/*
* Event when the countdown has reached zero but may not be finished. Might Loop.
*/
document.addEventListener('ccfwooReachedZero', function (event) {
// Do something in JS.
});
/*
* Event when the countdown has finished counting.
*/
document.addEventListener('ccfwooFinishedCounting', function (event) {
// Do something in JS.
});
Code language: JavaScript (javascript)
/*
* Event when the countdown has reached zero on the checkout page, trigger a reload.
*/
document.addEventListener('ccfwooReachedZero', function (event) {
// Check if the current page is /checkout/
if (window.location.pathname === '/checkout/') {
// Refresh the page
window.location.reload();
}
});
Code language: JavaScript (javascript)