skip to Main Content

I’m going to create a countdown timer for Woocommerce discounted products without using the plugin on my website theme and I’m looking for code to do it for me using JavaScript or php
please help….!!!

2

Answers


  1. For woocommerce countdown timer need to create custom fields and a custom time libraries or you can create own. Please look at the demo below

    https://axlmulat.com/woocommerce/woocommerce-tutorial-how-to-add-sales-countdown-timer-in-the-product-page/

    Login or Signup to reply.
  2. Am I correct what you want?

    <html>
    <body>
    <p id="demo"></p>
    
    <script>
    var count = 24*60*60; //24h
    var myVar = setInterval(myTimer, 1000);
    
    function myTimer() {
      count--;
      var seconds = count % 60 ;
      var minutes = Math.floor(count / 60) % 60;
      var hours   = Math.floor(count / (60*60)) % 24;
      if(count > 0) {
        document.getElementById("demo").innerHTML = hours+":"+minutes+":"+seconds;
      } else {
        document.getElementById("demo").innerHTML = "done"
        clearInterval(myVar);
      }
    }
    </script>
    
    </body>
    </html>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search