How to remove second decimal if it's zero

ManuelLop
Shopify Partner
29 2 2

We try with the money filter: "money_without_trailing_zeros" but it only remove .00 with the two decimals zeros, when only the last decimal is zero doesn't remove it, for example in price 23.90, doesn't remove the last zero and the price stay 23.90. How can we remove the second/last decimal if it's zero?

Replies 4 (4)

KetanKumar
Shopify Partner
36854 3637 11976

@ManuelLop 

Price Formatting 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
ManuelLop
Shopify Partner
29 2 2

Thanks for you early response but that no solve my problem

KetanKumar
Shopify Partner
36854 3637 11976

@ManuelLop 

can you please share store url?

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Partner | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing

MuhammadAqib
Shopify Partner
14 1 1

Hey,
1. In your Shopify Admin go to online store > themes > actions > edit code and search theme.liquid file.
2. In your theme.liquid file, find the </body> (press CTRL + F  on Windows 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>