Show price ranges & removing trailing zeros (debut)

Tourist
29 0 2

Hi there

I'd really appreciate it if someone can help! I have the debut theme and couldn't find a similar post.

I've added this to the product-card-grid.liquid 

{% if product.price_varies %} - {% include 'product-price' with product.price_max %}{% endif %}

but its not showing the max price. It shows £20-£20 insteadof £20-40

Also, I want to hide the trailing zeros on the site. 

Thanks
Fatema

0 Likes
Tourist
23 0 2

In this case, you will want to specify the price variable name.

{% if product.price_varies %} - {% include 'product-price' with price:product.price_max %}{% endif %}

To remove the trailing zeros, you can use the money_without_trailing_zeros filter in place of the other money filters.

0 Likes
Tourist
29 0 2

Hi Alex

Thank you for replying. I got my brother to help me and he added this to the product-price.liquid

{%- assign money_price = price | money_without_trailing_zeros -%}

{% assign money_price_min = product.price_min | money_without_trailing_zeros -%}
{% assign money_price_max = product.price_max | money_without_trailing_zeros -%}
{% if price_varies %}
    <span class="product-price__price">{{ money_price_min }} - {{ money_price_max }} </span>

Does this look right, as it works.

Thanks

 

0 Likes
Highlighted
Tourist
22 0 1

Hello,
if you want to show price range for each product with differents prices for variants, you can try this APP.
This app show price range for each product in all collections.
In app configuration, you can set also format for displaying price range, for example like From $5.00 to $9.99 or $5.00 - $9.99

0 Likes