From ffc413d1c84d361c052c6ee307c73634a6e6f3d8 Mon Sep 17 00:00:00 2001 From: Gustavo Luigi <=> Date: Thu, 8 Sep 2022 13:31:11 +0200 Subject: [PATCH] send number with country code in form --- assets/js/checkout.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/checkout.js b/assets/js/checkout.js index f04ab7f..d27f6e5 100644 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -12,8 +12,9 @@ function getAddressFiedlValue(addressComponents, $field){ } let input = document.querySelector("#ctelefon"); +let iti = null; if(input != undefined){ - let iti = window.intlTelInput(input, { + iti = window.intlTelInput(input, { initialCountry: "de", preferredCountries: ["de"], geoIpLookup: function(callback) { @@ -65,8 +66,6 @@ function updateProducts(){ } } -// iti.getNumber(); - $(window).on('load', function(){ updateProducts(); $("#successful-submitting-form").delay(4000).slideUp(200, function() { $(this).alert('close'); }); @@ -81,6 +80,7 @@ $(window).on('load', function(){ }); let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice); $('#ccart').val(cart); + $('#ctelefon').val(iti.getNumber()); objProducts = []; localStorage.setItem("products", JSON.stringify(objProducts)); form.unbind('submit').submit();