pi3lgrzym Posted March 3, 2020 Share Posted March 3, 2020 hi i need help with finaly price. in shop front -> product site. I use javascript to counted new price but dont know how update price variable. now if i push cart button i adde product with old price. selectElement2.addEventListener('change', (event) => { var $max = parseInt($('#szerokosc').attr('max')); var $min = parseInt($('#szerokosc').attr('min')); var $wartosc = document.getElementById("szerokosc").value if (document.getElementById("szerokosc").value>$max){ selectElement2.value = $max; const result2 = document.querySelector('.errorMsg2'); result2.style.display = 'block'; result2.textContent = `Maksymalny wymiar to ` + $max + `cm`; } else if (document.getElementById("szerokosc").value<$min) { selectElement2.value = $min; const result2 = document.querySelector('.errorMsg2'); result2.style.display = "block"; result2.textContent = `Minimalny wymiar to ` + $min + `cm`; } else { const result2 = document.querySelector('.errorMsg2'); result2.style.display = 'none'; var cenakoncowa = (cena/100)*$wartosc; cenakoncowa = cenakoncowa.toFixed(2); product.querySelector('[itemprop=price]').setAttribute('content',cenakoncowa); product.querySelector('[itemprop=price]').innerHTML = cenakoncowa.replace("\.",",") + ' zł'; } help pls. Link to comment Share on other sites More sharing options...
pi3lgrzym Posted March 6, 2020 Author Share Posted March 6, 2020 Witam. Może ktoś jednak może mi pomóc z aktualizacją zmiennej ceny za pomocą javascript?. Będę wdzięczny. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now