Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
https://empiricalwater.com/products/truth-serum
For example, a sample shows as $8.00 but I just want it to read $8.
Thank you
Solved! Go to the solution
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>
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. ★
https://stephens.world
support@stephensworld.ca
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?
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. ★
https://stephens.world
support@stephensworld.ca
Thanks for trying, unfortunately this did not work and it looks the default way with decimals on all numbers.
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>
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