0% found this document useful (0 votes)
16 views4 pages

Httpslay Buys - Comdocumentationwebcheckout Script PDF

Uploaded by

Matvejs Fokins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Httpslay Buys - Comdocumentationwebcheckout Script PDF

Uploaded by

Matvejs Fokins
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Webcheckout Script

1. Login ‘Shopify Store Admin’ > Click ‘Online Store’ > Click ‘Themes’ > Select

published theme and click ‘ …’ dots.

2. Click ‘Edit Code’.

3. Click ‘Add a new template’ in Templates section.


4. Select ‘search’ template type and write ‘laybuy-confirm’ file name and
select ‘liquid’ file type and click ‘Done’.

5. Copy and Paste below code in ‘search.laybuy-confirm.liquid’ file and click


‘Save’.

-------------------------copy below code--------------------------------------

{%- layout none -%}


<script type="text/javascript" id="laybuys_order_script_section">
const queryString = window.location.search;
console.log(queryString, 'queryString');
const urlParams = new URLSearchParams(queryString);
const collectionString = urlParams.get('collection');
var laybuyString = '';
laybuyString = urlParams.get('laybuy');
console.log(laybuyString, 'laybuyString');
if(laybuyString==1 && collectionString.includes('orders') &&
collectionString.includes('authenticate') ){
if(document.querySelector('body')){
document.querySelector('body').style.display = 'none';
}
deleteAllCookiesDDD();
redirectToUrl();
}
function deleteAllCookiesDDD() {
const cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i];
const eqPos = cookie.indexOf("=");
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
console.log("cleared all cookies laybuys");
}

function redirectToUrl(){
var url = collectionString?collectionString:'';
if(url!=''){
var unescapeUrl = unescape(url);
console.log("url is = "+url);
console.log(decodeURI(url));
console.log(unescape(url));
console.log("unescape url is = "+unescapeUrl);
window.location.href = unescapeUrl;
}
}
</script>
------------------------------------end-----------------------------------------------------

You might also like