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:

  1. Dynamic Countdown Settings: Set custom end times for sales or promotions.

  2. Fully Customizable Design: Change styles, colors, and fonts easily to match your store theme.

  3. Responsive Layout: Optimized for mobile, tablet, and desktop views.

  4. Lightweight and Fast: Minimal JavaScript and CSS for maximum performance.

  5. 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

  1. Add the Custom Liquid Section
    Navigate to your Shopify admin panel, go to "Themes," and add a new Custom Liquid section to your store.

  2. Paste the Reference Code
    Copy the provided code and paste it into the Custom Liquid section.

  3. Modify Variables
    Update the variables, see Flow Variable Descriptions 👇.

  4. 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

Variable Name

Description

Default Value

How to Modify

countdownTargetDate

Target date and time for the countdown.

"2024-12-31T23:59:59"

Replace with your desired end date.

updateInterval

How often the timer updates (in milliseconds).

1000

Adjust to control the update frequency.

#days, #hours, etc.

HTML elements to display time units.

N/A

Customize the IDs or classes if needed.

.countdown-container

The container for all time units.

Flexbox layout for alignment

Modify styles to change layout.

Colors (CSS)

Background and text colors of the timer.

#ffffff (text), #000000 (background)

Change in CSS file.


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.