Shopping Cart Operations > Support
Add a countdown timer to the cart page - Encourage customers to buy!
(1/1)
hi_ts:
Add a countdown timer to the cart page - Encourage customers to buy!
I am looking to implement 2 key features:
1. Deducting the units added to the cart from the stock.
2. Adding a timer to the shopping cart (like 5 mins) and auto-delete from the cart if the checkout is not done before the timer expires.
Any suggestions will be very helpful. Many thanks.
Basara:
Hello.
You can create a block with the HTML including timer code and cart update javascript code https://abantecart.atlassian.net/wiki/spaces/AD/pages/12419073/HTML+Block
HADY:
Here is my suggestion to you :)
--- Code: ---<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p {
text-align: center;
font-size: 100px;
margin-top: 100px;
}
</style>
</head>
<body>
<h1>Today</p>26.08.2021</p> At (13:15:00).</h1></p><h1>We'll be Online...</h1> </p>
<p id="demo"></p>
<script>
// Set the date we're counting down to
var countDownDate = new Date("August 26, 2021 13:15:00").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "EXPIRED";
}
}, 1000);
</script>
</body>
</html>
--- End code ---
Basara:
Thank you
HADY:
--- Quote from: Basara on September 15, 2021, 01:13:07 AM ---Thank you
--- End quote ---
Thank you for editing my reply too.
Navigation
[0] Message Index
Go to full version