24/11テスト

お客様情報のご入力

-
ニュースとオファーをメールで受け取る

お支払い情報



 カート内の1つもしくは複数のアイテムは、後払い購入または定期購入であることを理解しています。
利用規約 に同意して申込みます。

ご注文内容をご確認ください


商品名 【送料無料】キャンペーンヘアミルク - 1本
小計(税込)
送料
合計
購入ありがとうございました

お届け先情報をご確認ください


お名前
住所
電話番号
メールアドレス

お支払い方法を確認してください


決済方法 クレジットカード



`; let allowToThankPage = true; setTimeout(() => { if(allowToThankPage && thankPageURL != ""){ toThankPage(thankPageURL) } else if(allowToThankPage && thankPageURL == "") { window.location.reload(); } }, "5000"); $.ajax({ type: "post", url: "https://asia-northeast1-mikawaya-prod.cloudfunctions.net/rpa-run-auto-buy", data: JSON.stringify(obj), contentType: "application/json", dataType: "json", complete: function (jqXHR, textStatus) { $("#loading-overlay").hide() $("#mikawaya-submit").attr('disabled', false); $("#mikawaya-upsell-submit").attr('disabled', false); $("#mikawaya-float-upsell-submit").attr('disabled', false); hideCardError() if(jqXHR.responseText == "END OF SCRIPT"){ // Complete } $("#mikawaya-submit").prop('disabled', false); }, error: function(xhr, status, error) { allowToThankPage = false; $("#loading-overlay").hide() $("#mikawaya-submit").attr('disabled', false); $("#mikawaya-upsell-submit").attr('disabled', false); $("#mikawaya-float-upsell-submit").attr('disabled', false); if (xhr.responseText == "invalid_number") { $("#form-cnum").val(null).css("background-color", "#FCF0D4"); showCardError("正しいカード番号を入力してください") } else if (xhr.responseText == "invalid_expiry_year") { $("#form-card-expire-year").val(null).css("background-color", "#FCF0D4"); showCardError("正しい有効期限を入力してください") } else if (xhr.responseText == "invalid_expiry_month") { $("#form-card-expire-month").val(null).css("background-color", "#FCF0D4"); showCardError("正しい有効期限を入力してください") } else if (xhr.responseText == "invalid_cvc") { $("#form-security-code").val(null).css("background-color", "#FCF0D4"); showCardError("正しいセキュリティコードを入力してください") } else if (xhr.responseText == "invalid_user_lname") { showCardError("正しい姓を入力してください") } else if (xhr.responseText == "invalid_user_city") { showCardError("正しい市町村を入力してください") } else if (xhr.responseText == "invalid_user_email") { showCardError("正しいメールアドレスを入力してください") } else if (xhr.responseText == "invalid_user_address1") { showCardError("正しい住所1 を入力してください") } else if (xhr.responseText == "invalid_user_postal") { $("#form-pc-1").val(null).css("background-color", "#FCF0D4"); $("#form-pc-2").val(null).css("background-color", "#FCF0D4"); showCardError("正しい郵便番号を入力してください") } else if (xhr.responseText == "invalid_user_postal_length") { $("#form-pc-1").val(null).css("background-color", "#FCF0D4"); $("#form-pc-2").val(null).css("background-color", "#FCF0D4"); showCardError("正しい郵便番号を入力してください") } else if (xhr.responseText == "invalid_credit_number_length") { $("#form-cnum").val(null).css("background-color", "#FCF0D4"); showCardError("正しいカード番号を入力してください") } else if (xhr.responseText == "invalid_user_phone") { $("#form-phone-number").val(null).css("background-color", "#FCF0D4"); showCardError("正しい電話番号を入力してください") } $("#mikawaya-submit").prop('disabled', false); topFunction() validate() } }); } document.getElementById("mikawaya-submit").addEventListener("click", function() { if($("input[name=purchase-method-radio]:checked").val() == "amazon-pay"){ handleSubmitAmazonPay() } else { handleSubmit(); } }); //商品名変更され const postalCodeCheck = () => { //郵便番号エラーチェック let postalCodeCheckResult = false const postalCodeElm1 = $("#form-pc-1") const postalCodeElm2 = $("#form-pc-2") const postalCodeErrorElm = $("#mikawaya-error-postal-code") if(postalCodeElm1.val() != "" && postalCodeElm2.val() != ""){ if(postalCodeElm1.val().match(/^\d+$|(?:^\d+[/])+$|(?:^\d+[/])+\d+$/) && postalCodeElm2.val().match(/^\d+$|(?:^\d+[/])+$|(?:^\d+[/])+\d+$/)){ postalCodeCheckResult = true postalCodeElm1.toggleClass( "mikawaya-error-input", false ); postalCodeElm2.toggleClass( "mikawaya-error-input", false ); postalCodeErrorElm.hide() }else{ postalCodeCheckResult = false postalCodeElm1.toggleClass( "mikawaya-error-input", true ); postalCodeElm2.toggleClass( "mikawaya-error-input", true ); postalCodeErrorElm.show() } } return postalCodeCheckResult; } const emailCheck = () => { //メールアドレスエラーチェック let emailCheckResult = false const emailElm = $("#form-email") const emailErrorElm = $("#mikawaya-error-email") if(emailElm.val() != ""){ if( emailElm.val().match( /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ )){ emailCheckResult = true emailElm.toggleClass( "mikawaya-error-input", false ); emailErrorElm.hide() }else{ emailCheckResult = false emailElm.toggleClass( "mikawaya-error-input", true ); emailErrorElm.show() } } return emailCheckResult; } const isValueValid = (elm) => { const val = elm.val() if(val && val != false && val != ""){ return true } else { return false } } const isCreditCardExpired = (month,year)=>{ const exYear = parseInt(year) + 2000; const exMonth = parseInt(month) - 1; const exDay = new Date(exYear,exMonth + 1,0).getDate(); const dateObj = new Date(exYear,exMonth,exDay - 2); // Timezones fix. const dateNow = new Date(); return dateNow > dateObj; } function loopValueCheck(elmIDs){ let result = true; for (const id of elmIDs) { const thisElm = $(id) if (id == "#form-last-name" || id == "#form-first-name") { result = isValueValid($("#form-last-name")) && isValueValid($("#form-first-name")) if(result == false){ $("#mikawaya-required-name").show() !isValueValid($("#form-last-name")) && $("#form-last-name").toggleClass("mikawaya-error-input", true) !isValueValid($("#form-first-name")) && $("#form-first-name").toggleClass("mikawaya-error-input", true) } else { $("#mikawaya-required-name").hide() $("#form-last-name").toggleClass("mikawaya-error-input", false) $("#form-first-name").toggleClass("mikawaya-error-input", false) } } else if ( id == "#form-cnum") { const checkCardNo = thisElm.val().replaceAll(" ","") const cardCheckResult = checkCreditCard(checkCardNo) if(cardCheckResult.success){ if(cardCheckResult.type == "AmEx"){ $("#form-security-code").attr("maxlength","4") } else { $("#form-security-code").attr("maxlength","3") } $("#mikawaya-error-cnum").hide() thisElm.css("border", "revert"); } else { result = false; thisElm.css("border", "1px solid red"); $("#mikawaya-error-cnum").show() $("#form-security-code").attr("maxlength","3") } } else if ( id == "#form-security-code") { if(thisElm.val().length != thisElm.attr("maxlength")) { $("#mikawaya-error-security-code").show() thisElm.toggleClass("mikawaya-error-input", true) result = false; } else { $("#mikawaya-error-security-code").hide() thisElm.toggleClass("mikawaya-error-input", false) } } else if (id == "#form-card-expire-month" || id == "#form-card-expire-year") { result = isValueValid($("#form-card-expire-month")) && isValueValid($("#form-card-expire-year")) if(!isValueValid($("#form-card-expire-month"))){ result = false $("#form-card-expire-month").css("border", "1px solid red"); } else { $("#form-card-expire-month").css("border", "revert"); } if(!isValueValid($("#form-card-expire-year")) || $("#form-card-expire-year").val().length != $("#form-card-expire-year").attr("maxlength")){ result = false $("#form-card-expire-year").css("border", "1px solid red"); } else { $("#form-card-expire-year").css("border", "revert"); } if(result == true){ if(isCreditCardExpired($("#form-card-expire-month").val(),$("#form-card-expire-year").val())){ result = false $("#form-card-expire-month").css("border", "1px solid red"); $("#form-card-expire-year").css("border", "1px solid red"); } else { $("#form-card-expire-month").css("border", "revert"); $("#form-card-expire-year").css("border", "revert"); } } if(result == false){ $("#mikawaya-required-expire-date-year").show() } else { $("#mikawaya-required-expire-date-year").hide() } } else if(id == "#form-pc-1" || id == "#form-pc-2") { result = isValueValid($("#form-pc-1")) && isValueValid($("#form-pc-2")) if(!isValueValid($("#form-pc-1")) || $("#form-pc-1").val().length != $("#form-pc-1").attr("maxlength")){ result = false $("#form-pc-1").css("border", "1px solid red"); } else { $("#form-pc-1").css("border", "revert"); } if(!isValueValid($("#form-pc-2")) || $("#form-pc-2").val().length != $("#form-pc-2").attr("maxlength")){ result = false $("#form-pc-2").css("border", "1px solid red"); } else { $("#form-pc-2").css("border", "revert"); } if(result == false){ $("#mikawaya-required-postal-code").show() } else { $("#mikawaya-required-postal-code").hide() } } else if (isValueValid(thisElm) == false) { $("#mikawaya-required-" + thisElm.attr("name")).show() thisElm.toggleClass("mikawaya-error-input", true) result = false; } else { $("#mikawaya-required-" + thisElm.attr("name")).hide() thisElm.toggleClass("mikawaya-error-input", false) } if (id == "#mikawaya-checkbox") { if (thisElm.is(':checked') == false) { $("#mikawaya-required-checkbox").show() result = false; } else { $("#mikawaya-required-checkbox").hide() } } } return result; } async function stripeCheck (info){ return new Promise((resolve,reject)=>{ const cardInfo = { number: info.cardNumber, cvc: info.cvc, exp_month: info.expMonth, exp_year: info.expYear } Stripe.createToken(cardInfo, (status, response) => { if (response.error) { resolve({result: false}) if(response.error.code == "incorrect_number"){ $("#mikawaya-error-cnum").show() $("#form-cnum").css("border", "1px solid red"); }else if(response.error.code == "invalid_expiry_month"){ $("#mikawaya-required-expire-date-year").show() $("#form-card-expire-month").css("border", "1px solid red"); }else if(response.error.code == "invalid_expiry_year"){ $("#mikawaya-required-expire-date-year").show() $("#form-card-expire-year").css("border", "1px solid red"); } } else { resolve({result: true}) } }) }) } async function validate(isUpsellSubscriptionPersonalInfoValidate = false) { const showInfoButton = document.getElementById("show-confirm-info"); const isUpsellSubscriptionClick = getUpSellSubscriptionClickStatus() let checkListPersonalInfo = [ "#form-product-name", "#form-last-name", "#form-first-name", "#form-pc-1", "#form-pc-2", "#form-prefecture", "#form-city", "#form-address1", "#form-phone-number", "#form-email" ]; if(!isUpsellSubscriptionClick){ checkListPersonalInfo.push() } const checkListCreditCard = ["#form-cnum", "#form-card-owner-name", "#form-card-expire-month", "#form-card-expire-year", "#form-security-code", "#mikawaya-checkbox" ]; const checkFormValid = async () => { // -------------- 基本入力情報チェック -------------- const infoFormResult = loopValueCheck(checkListPersonalInfo) const personalInfoFormElm = document.getElementById("mikawaya-purchase-form"); if(infoFormResult == false){ personalInfoFormElm.scrollIntoView(true) return false } //サブスクアップセル用の個人情報確認、決済情報を入れる前 if(isUpsellSubscriptionPersonalInfoValidate){ return infoFormResult } // -------------- 決済入力情報チェック -------------- let paymentFormResult = true; if($("input[name=purchase-method-radio]:checked").val() == "credit-card"){ const paymentCheck = loopValueCheck(checkListCreditCard) paymentFormResult = paymentCheck && isValueValid($("#form-card-owner-name")) } const paymentInfoFormElm = document.getElementById("mikawaya-payment-header"); if (paymentFormResult == false) { paymentInfoFormElm.scrollIntoView(true) return false } // -------------- Stripeチェック -------------- let stripeCheckResult = true; if($("input[name=purchase-method-radio]:checked").val() == "credit-card"){ const stripeResultObj = await stripeCheck({ cardNumber: $("#form-cnum").val(), expMonth: $("#form-card-expire-month").val(), expYear: $("#form-card-expire-year").val(), cvc: $("#form-security-code").val() }) stripeCheckResult = stripeResultObj.result } if(stripeCheckResult == false){ return false } // -------------- 郵便番号チェック -------------- let postalCodeCheckResult = postalCodeCheck(); if(postalCodeCheckResult == false){ personalInfoFormElm.scrollIntoView(true) return false } // -------------- メールチェック -------------- let emailCheckResult = emailCheck(); if(emailCheckResult == false){ personalInfoFormElm.scrollIntoView(true) return false } return infoFormResult && paymentFormResult && postalCodeCheckResult && emailCheckResult && stripeCheckResult } let finalValidationResult = false; const allCheckResult = await checkFormValid(); if(allCheckResult) { finalValidationResult = true; } return finalValidationResult; } function toggleErrorDisplay(targetElm) { loopValueCheck(["#" + targetElm[0].id]); if(!targetElm.val() || targetElm.val() == ""){ targetElm.css("background-color", "#FCF0D4"); }else{ targetElm.css("background-color", "revert"); } } const clickAmazonPay = () => { const amazonPayBtnElm = document.querySelector('form[action="https://payments-fe.amazon.com/checkout/signin"] > button'); if(amazonPayBtnElm == null){ alert("AmazonPayが無効されています。それとも、AmazonPayの有効がまだ反映されていません。") $("#loading-overlay").hide() } amazonPayBtnElm.click() } const handleSubmitAmazonPay = async (isOneTimeUpsell = false) => { $("#loading-overlay").show() await fetch(window.Shopify.routes.root + 'cart/clear.js', { method: 'POST' }) let formData = { 'items': [{ 'id': isOneTimeUpsell ? getIdNumFromId($("#mikawaya-upsell-product-id").val()) : getIdNumFromId($("#form-product-name").val()), 'quantity': 1 }] }; fetch(window.Shopify.routes.root + 'cart/add.js', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(formData) }).then((res)=>{ setTimeout(() => { clickAmazonPay() }, 1500); }) } //商品名 document.getElementById("form-product-name").addEventListener("change", function() { $("#confirm-product-name").html( $("#form-product-name").find(':selected').text()); }); document.getElementById("form-last-name").addEventListener("input", function() { const thisElm = $("#form-last-name") toggleErrorDisplay(thisElm) const prep = this.value + " " +$("#form-first-name").val() $("#confirm-full-name").html(prep); }); document.getElementById("form-first-name").addEventListener("input", function() { const thisElm = $("#form-first-name") toggleErrorDisplay(thisElm) const prep = $("#form-last-name").val() + " " +this.value $("#confirm-full-name").html(prep); }); function prepAddress() { const prep = $("#form-pc-1").val() + "-" + $("#form-pc-2").val() +" "+ $("#form-prefecture").find(':selected').text() +" "+ $("#form-city").val() +" "+ $("#form-address1").val() +" "+ $("#form-address2").val() $("#confirm-address").html(prep); } function getAddressDataByZipcode(){ //郵便番号に自動的にハイフンを追加 const postalCode = $("#form-pc-1").val().trim() + "-" + $("#form-pc-2").val().trim() if(postalCode.length == 8){ $.ajax({ url: 'http://zipcloud.ibsnet.co.jp/api/search?zipcode=' + postalCode, dataType : 'jsonp', }).done(function(data) { if (data.results) { $("#form-prefecture").val("JP-" + data.results[0].prefcode).change(); $("#form-city").val(data.results[0].address2 + data.results[0].address3).trigger("input"); $("#form-city").css("background-color", "revert"); } }).fail(function(data) { alert('通信に失敗しました'); }); } } document.getElementById("form-pc-1").addEventListener("input", async function() { const thisElm = $("#form-pc-1") toggleErrorDisplay(thisElm) postalCodeCheck() if(this.value.length == 3 && $("#form-pc-2").val().length == 4){ getAddressDataByZipcode() } if(this.value.length == 3){ $( "#form-pc-2" ).trigger("focus"); } prepAddress(); }); document.getElementById("form-pc-2").addEventListener("input", async function() { this.value = this.value const currentValue = this.value const thisElm = $("#form-pc-2") toggleErrorDisplay(thisElm) postalCodeCheck() if(this.value.length == 4 && $("#form-pc-1").val().length == 3){ getAddressDataByZipcode() } if(currentValue == ""){ $( "#form-pc-1" ).trigger("focus"); } prepAddress(); }); document.getElementById("form-prefecture").addEventListener("change", function() { prepAddress(); }); document.getElementById("form-city").addEventListener("input", function() { const thisElm = $("#form-city") toggleErrorDisplay(thisElm) prepAddress(); }); document.getElementById("form-city").addEventListener("change", function() { const thisElm = $("#form-city") toggleErrorDisplay(thisElm) prepAddress(); }); document.getElementById("form-address1").addEventListener("input", function() { const thisElm = $("#form-address1") toggleErrorDisplay(thisElm) prepAddress(); }); document.getElementById("form-address2").addEventListener("input", function() { const thisElm = $("#form-address2") prepAddress(); }); // バリデーション関数 function validateTelNeo(value) { return /^[00]/.test(value) && libphonenumber.isValidNumber(value, 'JP'); } // 整形関数 function formatTel(value) { return new libphonenumber.AsYouType('JP').input(value); } function checkTelNo(tel) { if (!validateTelNeo(tel)) { $("#mikawaya-error-phone-number").show() return } $("#mikawaya-error-phone-number").hide() } document.getElementById("form-phone-number").addEventListener("input", function() { const thisElm = $("#form-phone-number") checkTelNo(this.value) toggleErrorDisplay(thisElm) $("#confirm-phone-number").html(this.value); }); document.getElementById("form-email").addEventListener("input", function() { const thisElm = $("#form-email") emailCheck() toggleErrorDisplay(thisElm) $("#confirm-email").html(this.value); }); const validateCardNumber = number => { const regex = new RegExp("^[0-9]{13,19}$"); if (!regex.test(number)){ return false; } return luhnCheck(number); } const luhnCheck = val => { let checksum = 0; // running checksum total let j = 1; // takes value of 1 or 2 for (let i = val.length - 1; i >= 0; i--) { let calc = 0; calc = Number(val.charAt(i)) * j; if (calc > 9) { checksum = checksum + 1; calc = calc - 10; } checksum = checksum + calc; // Switch the value of j if (j == 1) { j = 2; } else { j = 1; } } return (checksum % 10) == 0; } const checkCreditCard = cardnumber => { const ccErrors = []; ccErrors [0] = "カードの種類がわからない"; ccErrors [1] = "カード番号が提供されていない"; ccErrors [2] = "クレジット カード番号の形式が無効"; ccErrors [3] = "クレジットカード番号が無効"; ccErrors [4] = "クレジット カード番号の桁数が不適切"; ccErrors [5] = "このクレジット カード番号は詐欺行為に関連付けられている"; const response = (success, message = null, type = null) => ({ message, success, type }); const cards = []; cards [0] = {name: "Visa", length: "13,16", prefixes: "4", checkdigit: true}; cards [1] = {name: "MasterCard", length: "16", prefixes: "51,52,53,54,55", checkdigit: true}; cards [2] = {name: "AmEx", length: "15", prefixes: "34,37", checkdigit: true}; cards [3] = {name: "JCB", length: "16", prefixes: "35", checkdigit: true}; cards [4] = {name: "DinersClub", length: "14,16", prefixes: "30,36,38,54,55", checkdigit: true}; cards [5] = {name: "Discover", length: "16", prefixes: "6011,622,64,65", checkdigit: true}; if (cardnumber.length == 0) { return response(false, ccErrors[1]); } cardnumber = cardnumber.replace (/s/g, ""); if(!validateCardNumber(cardnumber)){ return response(false, ccErrors[2]); } if (cardnumber == '5490997771092064') { return response(false, ccErrors[5]); } let lengthValid = false; let prefixValid = false; let cardCompany = ""; for(let i = 0; i < cards.length; i++){ const prefix = cards[i].prefixes.split(","); for (let j = 0; j < prefix.length; j++) { const exp = new RegExp ("^" + prefix[j]); if (exp.test (cardnumber)) { prefixValid = true; } } if(prefixValid){ const lengths = cards[i].length.split(","); // Now see if its of valid length; for (let j=0; j < lengths.length; j++) { if (cardnumber.length == lengths[j]) { lengthValid = true; } } } if(lengthValid && prefixValid){ cardCompany = cards[i].name; return response(true, null, cardCompany); } } if (!prefixValid) { return response(false, ccErrors[3]); } if (!lengthValid) { return response(false, ccErrors[4]); }; return response(true, null, cardCompany); } $('#form-cnum').on('input', function (event) { const thisElm = $("#form-cnum") thisElm.val(thisElm.val().replaceAll(" ", "").split("").reduce((seed, next, index) => { if (index !== 0 && !(index % 4)) seed += " "; return seed + next; }, "")) if (this.value.length > 19) { this.value = this.value.substr(0,19) } toggleErrorDisplay(thisElm) }); document.getElementById("form-card-owner-name").addEventListener("input", function() { const thisElm = $("#form-card-owner-name") toggleErrorDisplay(thisElm) }); document.getElementById("form-card-expire-month").addEventListener("input", function() { const thisElm = $("#form-card-expire-month") toggleErrorDisplay(thisElm) if (this.value.match(/^\d+$|(?:^\d+[/])+$|(?:^\d+[/])+\d+$/) && this.value < 13 && this.value > 0) { this.value = this.value; } else if(!this.value.match(/^\d+$|(?:^\d+[/])+$|(?:^\d+[/])+\d+$/)) { this.value = '' } else if(this.value > 12) { this.value = '12' } else { this.value = '' } }); document.getElementById("form-card-expire-year").addEventListener("input", function() { const thisElm = $("#form-card-expire-year") toggleErrorDisplay(thisElm) }); //同意チェックボックス document.getElementById("mikawaya-checkbox").addEventListener("change", function() { const thisElm = $("#mikawaya-checkbox") toggleErrorDisplay(thisElm) }); document.getElementById("form-security-code").addEventListener("input", function() { const thisElm = $("#form-security-code") toggleErrorDisplay(thisElm) }); function isInViewport(el) { const rect = el.getBoundingClientRect(); return ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ); } function onPurchaseMethodChange(){ const selectedRadioButton = document.querySelector('input[name="purchase-method-radio"]:checked') $(".purchase-method-desc").hide() $("#"+ selectedRadioButton.id + "-desc").show() if($("input[name=purchase-method-radio]:checked").val() == "credit-card"){ $("#mikawaya-submit").html("ご注文完了へ") $("#mikawaya-upsell-submit").html("ご注文完了へ") $("#mikawaya-float-upsell-submit").html("ご注文完了へ") $("#mikawaya-submit").toggleClass("amazon-button-mode", false) $("#mikawaya-upsell-submit").toggleClass("amazon-button-mode", false) $("#mikawaya-float-upsell-submit").toggleClass("amazon-button-mode", false) } else if($("input[name=purchase-method-radio]:checked").val() == "amazon-pay") { $("#mikawaya-submit").html("") $("#mikawaya-upsell-submit").html("") $("#mikawaya-float-upsell-submit").html("") $("#mikawaya-submit").html("") $("#mikawaya-upsell-submit").html("") $("#mikawaya-float-upsell-submit").html("") $("#mikawaya-submit").toggleClass("amazon-button-mode", true) $("#mikawaya-upsell-submit").toggleClass("amazon-button-mode", true) $("#mikawaya-float-upsell-submit").toggleClass("amazon-button-mode", true) $("#mikawaya-submit").append(''); $("#mikawaya-upsell-submit").append(''); $("#mikawaya-float-upsell-submit").append(''); } else { $("#mikawaya-submit").html("ご注文完了へ") $("#mikawaya-upsell-submit").html("ご注文完了へ") $("#mikawaya-float-upsell-submit").html("ご注文完了へ") $("#mikawaya-submit").toggleClass("amazon-button-mode", false) $("#mikawaya-upsell-submit").toggleClass("amazon-button-mode", false) $("#mikawaya-float-upsell-submit").toggleClass("amazon-button-mode", false) } $("#confirm-payment-method").html($("input[name=purchase-method-radio]:checked").attr("label")) } $(window).scroll(function() { var winScrollTop = $(window).scrollTop(); var winHeight = $(window).height(); var floaterHeight = $('#mikawaya-float-upsell-submit').outerHeight(true); var fromBottom = 20; var top = winScrollTop + winHeight - floaterHeight - fromBottom; $('#mikawaya-float-upsell-submit').css({'top': top + 'px'}); const mainBuyUpsellBtn = document.getElementById("mikawaya-upsell-submit") if(isInViewport(mainBuyUpsellBtn)){ $('#mikawaya-float-upsell-submit').css({ 'opacity' : 0 }) $('#mikawaya-float-upsell-submit').css({ 'pointer-events' : "none" }) }else{ $('#mikawaya-float-upsell-submit').css({ 'opacity' : 1 }) $('#mikawaya-float-upsell-submit').css({ 'pointer-events' : "auto" }) } });