'; // shipping.firstChild.style.cssText = "margin: auto;"; // shipping.firstChild.classList.add("shipping-cost"); // foot.insertBefore(shipping, foot.lastChild); foot.insertBefore(discount, foot.lastChild); clearInterval(checkContents); } },1000); } }); // adds discount notification and shipping info to the cart widget (mobile) $(document).ready(function(){ var discount_mob_log = 0; if (discount_mob_log == 0) { var checkContents = setInterval(function(){ if ($("#dropdown-cart .has-items .summary").length > 0){ discount_mob_log = 1; var foot = document.querySelector("#dropdown-cart .has-items .summary"); var discount = document.createElement("div"); discount.classList.add("total"); discount.innerHTML = 'Proceed to checkout to apply your discount'; // var shipping = document.createElement("div"); // shipping.classList.add("total"); // shipping.innerHTML = 'FREE Standard Shipping (7-14 days)'; // foot.insertBefore(shipping, foot.lastChild); foot.insertBefore(discount, foot.lastChild); clearInterval(checkContents); } },1000); } }); $(document).ready(function(){ // START FB PIXEL //all this is to send the inititate checkout to FB pixel let variants_arr = [ "30111312674880", "30111312707648", "30111312740416", ]; let titles_arr = [ "1XL", "2XL", "3XL", ]; let pp_count = 0; let urlParams = new URLSearchParams(window.location.search); let myParam = urlParams.get('variant'); let variant_name; let findVar = function() { for (let i = 0; i < variants_arr.length; i++) { if (myParam == variants_arr[i]) { variant_name = titles_arr[i]; } } } findVar(); let elem = document.querySelector("#add-to-cart-form > div.total-price > span"); let productCount = parseFloat(elem.innerText.replace('$','')); ; let observer = new MutationObserver(mutationRecords => { productCount = parseFloat(elem.innerText.replace('$','')); }); observer.observe(elem, { childList: true, subtree: true, characterDataOldValue: true }); function hashHandler(){ this.oldHash = window.location.href; this.Check; var that = this; var detect = function(){ if(that.oldHash!=window.location.href){ urlParams = new URLSearchParams(window.location.search); myParam = urlParams.get('variant'); findVar(); that.oldHash = window.location.href; } }; this.Check = setInterval(function(){ detect() }, 100); } var hashDetection = new hashHandler(); function listener(event) { if (event.origin == "https://www.paypalobjects.com" && pp_count == 0) { let obj = event; pp_count ++; fbq('track', 'InitiateCheckout', { content_type: 'product_group', content_ids: 4100585979968, value: `${productCount}`, currency: 'USD', content_name: `Plus Size Sleeveless A-line Evening Dress - ${variant_name}`, content_category: 'Plus' }); } } if (window.addEventListener) { window.addEventListener("message", listener); } else { // IE8 window.attachEvent("onmessage", listener); } }); // END FB PIXEL