How can I eliminate '.00' from converted prices?

Hi, i am trying to remove the decimal “.00” from my converted prices, first of all, i have changed the {{ amount }} to {{ amount_no_decimals }}, so it worked perfectly with the default currency.

So what i did is, i added the remove filter to the price tag, {{ 25000 | money | remove ‘.00’ }}, also it is working normally with the default currency, but when i change the currency it remains 250.00.

So any idea what can i do to remove the ‘.00’ from the converted prices?

Thank you.

@err404
Check out this link I hope it will be helpful for you.
http://help.forsbergplustwo.com/en/articles/3960068-adding-and-removing-decimals-from-prices

Thank you.

Hey @Zworthkey ,

Thank you for your reply, and that’s what i did and mentioned in my post, it works with the default currency, but when i switch the currency, i still have “.00”.

I just wait to point out that instead of doing this:

{{ 25000 | money | remove '.00' }}

You should be doing this:

{{ 25000 | money_without_trailing_zeros }}

See Shopify’s documentation on money filters for more info on that https://shopify.dev/api/liquid/filters/money-filters

Are you using Shopify’s multiple currency feature and when you switch to another currency does it change the URL to have a country code in it?

@samthewebb

No, i am not using Shopify’s multiple currency feature and when i switch to another currency it doesn’t change the URL to have a country code in it. And thank you for sharing the code snippet

{{ 25000 | money_without_trailing_zeros }}

but it doesn’t work with the switched currency.

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 (press CTRL + F on Windows or command + F on Mac)
  3. paste this code right above the tag:

Hello Muhammad,

Your script works, but when I change variant on the product page, the price displays the decimals again (the script doesn’t load again for the new url of the new selected variant).

How can I fix this please ?

Same issue for me - works when you refresh screen though.