Shopify Countdown Timer Plugin – An Open-Source Countdown Solution for Your Store
Overview:
This open-source Shopify Countdown Timer Plugin is a sleek, customizable, and easy-to-integrate widget designed to create urgency and boost conversions on your Shopify store. With dynamic settings and reusable variables, it provides full flexibility for developers and store owners to modify the timer to fit their branding and campaign needs.
Key Features:
Dynamic Countdown Settings: Set custom end times for sales or promotions.
Fully Customizable Design: Change styles, colors, and fonts easily to match your store theme.
Responsive Layout: Optimized for mobile, tablet, and desktop views.
Lightweight and Fast: Minimal JavaScript and CSS for maximum performance.
Developer-Friendly: Variables and code structure designed for easy modification.
Live Demo
Here’s how the countdown timer looks in action:
Installation and Integration Steps
Add the Custom Liquid Section
Navigate to your Shopify admin panel, go to "Themes," and add a new Custom Liquid section to your store.Paste the Reference Code
Copy the provided code and paste it into the Custom Liquid section.Modify Variables
Update the variables, see Flow Variable Descriptions 👇.Save and Preview
Save the changes, then preview your store to ensure the tabs and content are displayed correctly.
<div id="countdown-timer">
<div class="countdown-container">
<span id="days" class="time-unit">00</span><span>Days</span>
<span id="hours" class="time-unit">00</span><span>Hours</span>
<span id="minutes" class="time-unit">00</span><span>Minutes</span>
<span id="seconds" class="time-unit">00</span><span>Seconds</span>
</div>
</div>
<script>
// Countdown Timer Variables
const countdownTargetDate = new Date("2024-12-31T23:59:59").getTime(); // Modify target date here
const updateInterval = 1000; // Update interval in milliseconds
// Timer Functionality
function startCountdown() {
const timer = setInterval(() => {
const now = new Date().getTime();
const timeLeft = countdownTargetDate - now;
if (timeLeft <= 0) {
clearInterval(timer);
document.getElementById("countdown-timer").innerHTML = "Offer Expired!";
return;
}
// Time Calculations
const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);
// Update HTML
document.getElementById("days").textContent = days;
document.getElementById("hours").textContent = String(hours).padStart(2, "0");
document.getElementById("minutes").textContent = String(minutes).padStart(2, "0");
document.getElementById("seconds").textContent = String(seconds).padStart(2, "0");
}, updateInterval);
}
// Start the Countdown
startCountdown();
</script>
<style>
#countdown-timer {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px 0;
color: #ffffff;
background: #000000;
padding: 10px;
border-radius: 5px;
}
.countdown-container {
display: flex;
justify-content: center;
gap: 10px;
}
.time-unit {
font-size: 2rem;
font-weight: bold;
margin-right: 5px;
}
</style>
Variable Descriptions
Conclusion
This open-source Shopify Countdown Timer Plugin is designed for developers and store owners seeking to create urgency and enhance their store's performance. With its flexibility and ease of integration, it's a perfect tool to boost sales and improve the shopping experience. Download, customize, and start boosting your store today! 🚀
For any issues or customization needs, feel free to reach out to us at 📧 tentech.ai.2023@gmail.com.