Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello,
I want to remove the trailing zeros for products with a price like "50€". I don't want "50.00€".
However I still want the decimals to show if a product is "50.95€" obviously.
Can someone please help me add this to my store? I am using the Prestige Theme.
in your snippets/price-list.liquid file
find
{%- if settings.currency_code_enabled -%} {{- variant.price | money_with_currency -}} {%- else -%} {{- variant.price | money -}} {%- endif -%}
and replace it with
{%- assign price_in_cents = variant.price | times: 100 -%}
{%- assign has_cents = price_in_cents | modulo: 100 -%}
{%- if settings.currency_code_enabled -%}
{%- if has_cents > 0 -%}
{{- variant.price | money_with_currency -}}
{%- else -%}
{{- variant.price | money_with_currency | remove: '.00' -}}
{%- endif -%}
{%- else -%}
{%- if has_cents > 0 -%}
{{- variant.price | money -}}
{%- else -%}
{{- variant.price | money | remove: '.00' -}}
{%- endif -%}
{%- endif -%}