You guys are the worst.
When I docked my ship, the drunk postman was waiting with shitloads of emails, I mean letters, many of them saying you want the countdown timer from my awesome shopify hack post. And if you drunkards ask, we deliver, right?
I’m talking about this thingy here ->
Hell yeah we deliver. If you have any questions, feel free to ask a developer and not us. So, we got that out of the way, now – good luck with implementation and don’t forget to test, test and test, or how we like to say drink rum, test, drink rum again, test, pass out.
The How to segment is locked ofc. If you are our pirate, you already have access, if no and you don’t want to sign up, well fuck you?
BE AWARE, THIS DOES NOT WORK FOR EVERY THEME, YOU HAVE TO BE A CODER TO MAKE IT WORK. If you are not, you should get the real deal app from the Shopify app store, called HURRIFY. It works perfectly and it is great.
[emaillocker]
How to:
1. Open Shopify store Admin. (click here)
2. Once you have logged in, click on “Online Store” located in left sidebar of your Shopify store Admin (World icon).
3. Click on “…” 3 dots in your top right corner to customize template file.
4. Select from drop down menu “Edit HTML/CSS”.
5. Click on “Themes” and the select “product.liquid” template.
6. Press “Control+F”, search for “add-to-cart”, locate end of your form.
7. Paste code, starting at the end of form. (previous step 4. located end of form)
<style>#progress_bar{margin-top:15px}.progressbar.progressbar{background:#ffe8e8;border:0px solid whitesmoke;height:11px}.progressbar.progressbar div{background:#d95350;height:11px}.progressbar.progressbar.active div{-webkit-animation:2s linear 0s normal none infinite running progress-bar-stripes;animation:2s linear 0s normal none infinite running progress-bar-stripes}.progress-striped.progressbar.progressbar div{background-image:-webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0));background-size:40px 40px}.items-count{margin-top:0px;margin-bottom:0px}.count{color:#a94442;padding:1px}.items-count p{padding-bottom:5px;margin:0;text-transform:uppercase;font-weight:700;text-align:center;font-family:"Open Sans",Arial,sans-serif}.progressbar{position:relative;display:block;background-color:#ca0000;border:1px solid #ddd;margin-bottom:15px;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, .1);box-shadow:inset 0 1px 2px rgba(0, 0, 0, .1)}.progressbar > div{background-color:#ca0000;width:0;margin-bottom:0;height:15px}.progressbar > div.less-than-ten{background-color:#ca0000 !important}#clock-ticker{display:block;margin-bottom:15px}#clock-ticker .block{position:relative;color:#000;font-weight:bold;float:left;text-align:center;width:25%}#clock-ticker .block .flip-top{width:88px;height:39px;line-height:40px;font-size:40px;text-align:center}#clock-ticker .block .label,span.flip-top{color:#000;font-weight:bold;text-align:center;font-size:14px;text-transform:uppercase;width:88px;line-height:25px;font-family:"Open Sans",Arial,sans-serif}</style> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> function randomIntFromInterval(min, max) {return Math.floor(Math.random() * (max - min + 1) + min);} // Settings are here var total_items = 50; var d = new Date(); var min_items_left = 12; var max_items_left = 20; var remaining_items = randomIntFromInterval(min_items_left, max_items_left); var min_of_remaining_items = 1; var decrease_after = 1.7; var decrease_after_first_item = 0.17; // Davy Jones' Locker (function($){$.fn.progressbar=function(){var a="<p>Hurry! Only <span class='count'>"+remaining_items+"</span> left in stock.</p>"+"<div class='progressbar'><div style='width:100%'></div></div>";this.addClass('items-count');this.html(a+this.html());updateMeter(this);var b=this;setTimeout(function(){remaining_items--;if(remaining_items<min_of_remaining_items){remaining_items=randomIntFromInterval(min_items_left,max_items_left)}$('.count').css('background-color','#CE0201');$('.count').css('color','#fff');setTimeout(function(){$('.count').css('background-color','#fff');$('.count').css('color','#CE0201')},1000*60*0.03);b.find(".count").text(remaining_items);updateMeter(b)},1000*60*decrease_after_first_item);setInterval(function(){remaining_items--;if(remaining_items<min_of_remaining_items){remaining_items=randomIntFromInterval(min_items_left,max_items_left)}$('.count').css('background-color','#CE0201');$('.count').css('color','#fff');setTimeout(function(){$('.count').css('background-color','#fff');$('.count').css('color','#CE0201')},1000*60*0.03);b.find(".count").text(remaining_items);updateMeter(b)},1000*60*decrease_after)};function updateMeter(a){var b=100*remaining_items/total_items;if(remaining_items<10){a.find('.progressbar div:first').addClass('less-than-ten')}a.find('.progressbar').addClass('active progress-striped');setTimeout(function(){myanimate(a.find('.progressbar div:first'),b);a.find('.progressbar').removeClass('active progress-striped')},1000)}}(jQuery));function myanimate(a,b){var c=0;var d=parseInt(a.closest('.progressbar').css('width'));var e=Math.floor(100*parseInt(a.css('width'))/d);if(e>b){c=e}function frame(){if(e>b){c--}else{c++}a.css('width',c+'%');if(c==b||c<=0||c>=100)clearInterval(f)}var f=setInterval(frame,40)} jQuery.noConflict()(function($){$(document).ready(function(){$("#progress_bar").progressbar();var tag="ctdn-12-12".match(/\d+/g);var hour=14;var theDaysBox=$("#numdays");var theHoursBox=$("#numhours");var theMinsBox=$("#nummins");var theSecsBox=$("#numsecs");var d=new Date();var n=d.getDay();var date=1;var gg=0;var hh=0;var ii=0;var nsec=0-d.getSeconds();if(nsec<0){nsec=60-d.getSeconds();gg=1}var nmin=0-d.getMinutes()-gg;if(nmin<0){nmin=60-d.getMinutes()-gg;hh=1}var nhrs=14-d.getHours()-hh;if(nhrs<0){nhrs=38-d.getHours()-hh;ii=1}var ndat=date-1;if(ndat<0){var mmon=d.getMonth();ndat=30+date-d.getDate()-ii}theSecsBox.html(nsec);theMinsBox.html(nmin);theHoursBox.html(nhrs);theDaysBox.html(ndat);var refreshId=setInterval(function(){var e=theSecsBox.text();var a=theMinsBox.text();var c=theHoursBox.text();var b=theDaysBox.text();if(e==0&&a==0&&c==0&&b==0){}else{if(e==0&&a==0&&c==0){theDaysBox.html(b-1);theHoursBox.html("23");theMinsBox.html("59");theSecsBox.html("59")}else{if(e==0&&a==0){theHoursBox.html(c-1);theMinsBox.html("59");theSecsBox.html("59")}else{if(e==0){theMinsBox.html(a-1);theSecsBox.html("59")}else{theSecsBox.html(e-1)}}}}},1000);});});</script> <div class="items-count" id="progress_bar"></div><div id="clock-ticker" class="clearfix"><div class="block"><span class="flip-top" id="numdays">0</span><br><span class="label">Days</span></div><div class="block"><span class="flip-top" id="numhours">1</span><br><span class="label">Hours</span></div><div class="block"><span class="flip-top" id="nummins">23</span><br><span class="label">Minutes</span></div><div class="block"><span class="flip-top" id="numsecs">36</span><br><span class="label">Seconds</span></div> </div>
[/emaillocker]
16 comments
hey many thanks for this. I don’t have access to edit the html/css code and also I don’t want this on every page. Only on my selected product how can I go about doing this.
You need a developer to fix this issue for you. It shouldnt be hard if he is skilled in shopify.
Hi Daniel, let me do that for you. 🙂
by the way, thanks for this Karlo.
Could you do that with my theme as well?
Hey Daniel,
Did you manage to make it work for certain products only?
Wazzup Andy,
if you want it to show for certain products only just do:
{% if template == “product” and product.handle contains “product-handle” %}
**PLACE WHOLE CODE HERE**
{% endif %}
so that the code will only be rendered when the page is a product and the product is what you selected.
Hi Karlo, the countdown is not working for me neither “hurry, only…” I have Venture Theme. Can you check this? Thanks
Well, its not universal, so you have to have some dev knowledge to make it work on all themes, best to find a rookie dev, its an easy job.
why there is no add-to-cart inside my product liquid? i use the retina theme
Well, all themes are unique and the hack requires some coding and knowledge. Find someone to help you inside FB groups, its an easy fix
Thanks, this is awesome!
Glad you like it!
Karlo it is amazing, how do you make sense of giving it free?
Can we share it with other becoming pirates?
Greetings from Mexico..
Ofc! More pirates, the better 😉