Personalized checkout and custom promotions with Shopify Scripts
i use this code to update price , 1st variant price is working fine but the 2nd variant price isnt updating . It's getting update price from 1st variant . here's the website , kindly check and help me ASAP
https://www.revomadic.com/products/smart-cupping-massager-gp?variant=41744379248816
<script>
function change(value){
document.getElementById("count").value= 1*value;
// CODE FOR PRICE
var realPrice = window.localStorage.getItem('realPrice');
var comparePrice = window.localStorage.getItem('comparePrice');
var savePrice = window.localStorage.getItem('savePrice');
var currency = window.localStorage.getItem('currency');
document.querySelector("#ProductPrice .money").innerHTML= currency +(parseInt(realPrice)* parseInt(document.getElementById("count").value)).toLocaleString() + '.00';
document.querySelector("#ComparePrice .money").innerHTML= currency +(parseInt(comparePrice)* parseInt(document.getElementById("count").value)).toLocaleString() + '.00';
var elList = document.querySelectorAll(".number-discount_saved .money");
elList.forEach(el => el.innerHTML= currency +(parseInt(savePrice)* parseInt(document.getElementById("count").value)).toLocaleString() + '.00');
// END PRICE CODE
</script>
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025