Hide product.price on $0 value item in product gird (prestige theme)

Hi there. We have some products in our range which need consultation so I’ve designed a new product template which doesn’t show price.

However, on the collection grid, those products show “$0” which doesnt look right.

I just to be able to hide those prices on the collection grids.

I’ve been playing around with inserting the following code in product-item.liquid but I’m not sure of what I’m doing. I don’t know what to add after {{product.price}} in order to hide it.

{%- if product.price = “$0” -%}
{{ product.price }}
{%- endif -%}

Any help / suggestions is appreciated!

Actually - scratch that. I’ve solved it. FYI below

I added the following code to theme.css in the product price section

.Price–hide {
display: none;
}

And then added this IF command to the product-item.liquid snippet (in the section where similar commands were running)

{%- elsif product.price < 1 -%}
{{ product.price | money_without_trailing_zeros }}
{%- elsif product.price_varies -%}

Hope that helps anyone else out there with similar problem

HI @LakerDC ,

Welcome to the Shopify Community! Thanks for asking a good question on community.

I saw your issue and it is very simple for me.

also the above code is not the correct way to do. You can only add one line of code before {{ product.price }} . If any confusion please let me know, I’m here to help you.

{% if product.price > 0 %}
 here you can add your product price code
{% endif %}

Thanks

Thank you Aashish for replying.

Where do you suggest I insert the code you suggest?

To be honest, the solution I put forward is working perfectly for me at the moment - so I’m not inclined to change it and ‘rock the boat’.

Look forward to hearing from you.

Hi @LakerDC ,

as you described above code is not good for the theme perspective. If we talk about the code standard you have to do like I told you.

Thanks

I’m happy to try your code - just let me know where to insert it?

Hi @LakerDC ,

You can use this code just before {{ product.price | money_without_trailing_zeros }} line like

{% if product.price > 0 %}
 {{ product.price | money_without_trailing_zeros }}
{% endif %}

If any confusion/query please let me know I will help you.

Thanks