Remove Trailing Zeros From Shopify Price With JS

Share Now

1. In your Shopify Admin go to online store > themes > actions > edit code
2. In your theme.liquid file, find the (press CTRL + F or command + F on Mac)
3. paste this code right above the tag

function updatePrice(){
var prices = document.querySelectorAll(`.price-item`);


if (!prices)return;

for (var each of prices){
each.innerText = each.innerText.replace('.00', '');
}
}

window.onload = function() {
  setTimeout(updatePrice, 50);
}
Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert