Remove Trailing Zeros From Storefront Price

Solved
Highlighted
New Member
3 0 0

Hi there! I'm using the Debut theme and would like to remove the trailing zeros from my whole number product prices in the storefront. Here's an example of another brand doing it successfully in their product recommendation section.

Can anyone advise how to tackle this?

0 Likes
Highlighted
Astronaut
1084 178 213

Hello,

Thank you for your question. 

Please share your store URL, page URL and also password (if your store has one), I'll help you out to the best of my ability.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes
Highlighted
Astronaut
1084 178 213

This is an accepted solution.

Hey,

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

 

<script>
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);
            }

</script>

 


Ideally you'd want to get a developer to code it in a cleaner way into your theme via Liquid, but this will do the trick.

Please let me know whether it works.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
1 Like
Highlighted
New Member
3 0 0

Diego, thank you so much. It worked beautifully!

0 Likes
Highlighted
Astronaut
1084 178 213

@scedelstein hey, glad to hear. You're welcome!

Next time you need something feel free to contact me personally via e-mail, I'll be happy to help.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Hire me! Recommended by 25+ customers on Facebook. Click here to read their reviews.
◦ Contact me at: diego.boarutto.fortes@gmail.com
0 Likes