Cannot round on-sale product price in collections in Brooklyn Theme

I want the sale prices to round up or down. I’ve achieved this on the individual product page, but in the collection page it still shows the decimal point and extra digit.

I have added money_without_trailing_zeros in the product-grid-item.liquid code. What have I missed?

This is detail from the product page on the left, and the same product in the collection page on the right

Thank you for any help you can offer!

1 Like

@kimgrover

store url?

https://raedunnwear.com/

yes please see this

https://www.google.com/url?q=https://liquify.design/shopify-developer-guide-display-percentage-discount-shopify/&sa=D&source=editors&ust=1630589470465000&usg=AOvVaw2xAwai8kq91aflf1RNSHmq

The discount is calculated properly, the problem is that we do not want to show the cents: .20 for example. We want to round the figure. As it is now doing on the individual product view.

Here is the code in product-grid-item.liquid:

{% capture saved_amount %}{{ product.compare_at_price | minus: product.price | times: 100 | divded_by: product.compare_at_price | round }}{% endcapture %}

{{ 'products.general.save_html' | t: saved_amount: saved_amount }}%

{% endif %}

In product-price.liquid code (which presents without the .00, as we want)
There is PriceA11y,
This is all of the code:

{%- if variant.compare_at_price > variant.price -%} {{ 'products.general.regular_price' | t }} {{ variant.compare_at_price | money_without_trailing_zeros }} {{ 'products.general.sale_price' | t }} {%- else -%} {{ 'products.general.regular_price' | t }} {{ 'products.general.sale_price' | t }} {%- endif -%}


{{ variant.price | money_without_trailing_zeros }}

{%- capture unit_price_separator -%} / {{ 'general.accessibility.unit_price_separator' | t }}  {%- endcapture -%}

{%- capture unit_price_base_unit -%}

{%- if variant.unit_price_measurement -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endif -%}

{%- endcapture -%}

{{ ‘products.general.unit_price’ | t }}
{{ variant.unit_price | money_without_trailing_zeros }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}

@kimgrover

you have use third partly filter app on collection page?

KetanKumar, thanks so much for sticking with me, I really appreciate it!

I didn’t set up the site originally so I’m uncertain if these apps are in use, but they are in the apps folder:

Variant Options Swatch King

Wipeout

1 Like

@kimgrover

its my pleasure to help us

oh i see third party app doesn’t our control