Last active
September 5, 2019 19:37
-
-
Save B-uny/bc9009c017c7685ce5a2b7c6356f1c2f to your computer and use it in GitHub Desktop.
The following still needs to be cleaned up but it works. Editing as I get the chance. This works to create a button that when clicked will send the user to a checkout page and send line_items and notes to the webhook. Legend as follows: "orderTag = note textarea; updatec=update input button; redirect-href= whatever your page is"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--progress bar edited From: https://www.w3schools.com/howto/howto_js_progressbar.asp--> | |
<!--Thank you html & countDown function from: https://www.jotform.com/help/89-Create-a-Custom-Thank-you-page-with-Auto-redirect--> | |
<!--redirect page--> | |
<!--create a new page and add this to the script area--> | |
<div style="text-align: center;"> | |
<h1>Thank you!</h1> | |
<p> </p> | |
<p>Your request has been received and our team is reviewing. Need another estimate? Click Upload RFQ or Build RFQ Request on the tab above!</p> | |
<span id="timer"> </span> | |
<div id="myProgress" style="width: 100%; background-color: #ddd;"> | |
<div id="myBar" style="width: 1%; height: 30px; background-color: black;"></div> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
function move() { | |
var elem = document.getElementById("myBar"); | |
var width = 1; | |
var id = setInterval(frame, 30); | |
function frame() { | |
if (width >= 100) { | |
clearInterval(id); | |
} else { | |
width++; | |
elem.style.width = width + '%'; | |
} | |
} | |
} | |
move(); | |
</script> | |
<script> | |
function countDown(){ | |
var timer = document.getElementById("timer"); | |
timer.innerHTML = "This page will redirect to your account in a few seconds."; | |
} | |
countDown(); | |
// ]]></script> | |
<script>// <![CDATA[ | |
$(document).ready(function () { | |
window.setTimeout(function () { | |
$.ajax({ | |
url: '/cart/clear.js', | |
type: "POST", | |
data: {note:''}, | |
dataType: 'json', | |
success: function(html) {$.ajax({ | |
url: '/cart/update.js', | |
type: "POST", | |
data: {note:" "}, | |
dataType: 'json', | |
success: function(){ setTimeout(redirect, 2000)} | |
}); | |
function redirect(){ | |
window.location.href = "https://titan-dod.com/account";} | |
} | |
}); | |
}, 2000); | |
}); | |
<!--cart.liquid page--> | |
<!--past this script at the top of the page, dont forget to rename the element id's--> | |
<script> | |
function addComplete(){ | |
setCartNote(); | |
var timetoready = setTimeout(clickUpdate, 1000); | |
} | |
function setCartNote(){ | |
var a1 = "READY"; | |
document.getElementById("orderTag").innerHTML ="" + a1 + ""; | |
} | |
function clickUpdate(){ | |
document.getElementById('updatec').click(); | |
} | |
$(document).ready(function() { | |
var checker = document.getElementById("orderTag").innerHTML; | |
if (checker == 'READY'){ | |
redirect(); | |
} | |
else{} | |
}); | |
function redirect(){ | |
window.location.href = 'https://titan-dod.com/pages/thanks-you'; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment