Removing Decimals site-wide for ALL currencies (Expanse)

saraki
Excursionist
68 1 5

Hi all

I am looking for a solution to remove the ,00 and roundup anything over ,00 for all prices site-wide.

I was able to remove the decimals for the main shop currency in the settings, however all converted currencies still have the decimals and I cannot figure out how to remove them. 

 

For example

100.00 to be displayed as 100

100.95 to be displayed as 101

 

Is there a specific code I can add to either the theme.liquid or price.liquid?

 

my shop: www.inibo.co

password: secret

 

Any ideas?

Thank you so much.

Sarah
inibo.co
pw: secret
Replies 7 (7)

ThePixelEdge
Shopify Partner
164 16 17

Hello @saraki 
use {{amount_no_decimals}} instead. of ${{amount}} under Currency formatting
Store-details-Currency·-Shopify.png
Hope this soultions worked for , 
If this solution didn't work for you, please let us know. We're happy to assist further

If helpful then please Like and Accept Solution .
Buy me A Coffee

Whatsapp :- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications


Connect with Us in Our DMs | teampixeledge@gmail.com
saraki
Excursionist
68 1 5

@ThePixelEdge 

Thanks but this is for the main shop currency only. I already did that.

Is there a code to achieve this for ALL converted currencies?

 

Sarah
inibo.co
pw: secret
ThePixelEdge
Shopify Partner
164 16 17

Hi @saraki ,

If you are not familiar with the liquid code I would recommend sharing Collaborator access with us .

For Collection Pages and Featured Collection Section , It would have to be in the grid-product-item under the snippets where the code for Price is located or there might be an entirely seperate Price.liquid file where you would find the

{{ product.price }} 

which you would need to replace with 

 {{ product.price | money_without_trailing_zeros }} .

 

hope this helps . Let me know if you need our assistance 

If helpful then please Like and Accept Solution .
Buy me A Coffee

Whatsapp :- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications


Connect with Us in Our DMs | teampixeledge@gmail.com
saraki
Excursionist
68 1 5

Thank you @ThePixelEdge, I do have a price.liquid file, I will try to replace it. 
does "without trailing zeros" only apply to zeros, or also other numbers after the comma? 

Ideally I would want to round up to zero and not see the zeros, you know what I mean?

Sarah
inibo.co
pw: secret
saraki
Excursionist
68 1 5

Never mind, I am not going to touch it because I don't understand it at all.. there is no {{product.price}}, only {{amount}}, so I don't know what to do.

 

My price.liquid looks like this:

{% comment %}
/**
* @param {number} price - the price
* @param {shop} shop - the shop object
* @param {boolean} superscript_decimals - whether to superscript decimals
*/
{% endcomment %}

{%- assign formatted_price = price | money -%}
{%- unless shop.money_format contains 'money' or shop.money_format contains '.' -%}
{%- if superscript_decimals -%}
{%- if shop.money_format contains '{{amount}}' or shop.money_format contains '{{ amount }}' -%}
{% capture formatted_price %}{{ formatted_price | replace: '.', '<sup>' | append: '</sup>' }}{% endcapture %}
{%- elsif shop.money_format contains '{{amount_with_comma_separator}}' or shop.money_format contains '{{ amount_with_comma_separator }}' -%}
{% capture formatted_price %}{{ formatted_price | replace: ',', '<sup>' | append: '</sup>' }}{% endcapture %}
{%- endif -%}
{%- endif -%}
{%- endunless -%}

<span aria-hidden="true">{{ formatted_price }}</span>
<span class="visually-hidden">{{ price | money }}</span>

 

There is also price-varies.liquid and price-range.liquid.

 

How do I give you collaborator access?
Thank you @ThePixelEdge 

Sarah
inibo.co
pw: secret
ThePixelEdge
Shopify Partner
164 16 17

Hi @saraki 

Kindly Message me in the DM so I can explain and you can share the access with me . Its a 4 digit code that should be shared Privately 
Here is how you can locate it In Shopify admin > Settings > Users and permissions page of their Shopify admin . You can find collaborator access code . 

If helpful then please Like and Accept Solution .
Buy me A Coffee

Whatsapp :- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications


Connect with Us in Our DMs | teampixeledge@gmail.com
saraki
Excursionist
68 1 5

Done 🙂
Thank you

Sarah
inibo.co
pw: secret