Solved

How to remove .00 decimals from the one-time purchase option?

empiricalarby
Pathfinder
139 1 27

https://empiricalwater.com/products/truth-serum

 

For example, a sample shows as $8.00 but I just want it to read $8.

 

Thank you

Accepted Solution (1)

MuhammadAqib
Shopify Partner
14 1 1

This is an accepted solution.

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>

View solution in original post

Replies 5 (5)

StephensWorld
Shopify Expert
1137 123 288

Hey Empirical,

 

I believe the pricing on your product pages are being generated via the ReCharge app (https://apps.shopify.com/subscription-payments) ... so you'd have to reach out to their support team directly (support@rechargeapps.com) to see if this is possible to change. 

 

Otherwise, if it's being generated via the theme, and not the app, then you should be able to edit your store's 'currency formatting' (https://help.shopify.com/en/manual/markets/pricing/currency-formatting). 

 

Admin > Settings > Store Details > Store Currency > Change Formatting. 

 

Change where it says:

 

{{ amount }}

 

To:

 

{{ amount_no_decimals }}

 

I hope the above helps point you in the right direction! 🙂

 

Cheers,

Stephen

★ Did my post help? If yes, then please like and accept solution. ★

Hire me for your Shopify project @ stephens.world | support@stephensworld.ca

empiricalarby
Pathfinder
139 1 27

Hmm, it seems to remove decimals even from numbers that need them. I want $8.00 to be represented as $8, but I don't want $7.20 represented as $7. Can you help with that?

StephensWorld
Shopify Expert
1137 123 288

Try this: 

 

{{ money_without_trailing_zeros }}

 

Not sure if it works or not, but someone else recommended it in this thread: https://community.shopify.com/c/technical-q-a/remove-00-from-the-converted-prices/td-p/1263992 

★ Did my post help? If yes, then please like and accept solution. ★

Hire me for your Shopify project @ stephens.world | support@stephensworld.ca

empiricalarby
Pathfinder
139 1 27

Thanks for trying, unfortunately this did not work and it looks the default way with decimals on all numbers.

MuhammadAqib
Shopify Partner
14 1 1

This is an accepted solution.

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>