How can I effectively hide product prices in certain collections?

Solved

How can I effectively hide product prices in certain collections?

nmaryami
Excursionist
21 2 6

Hello,

I have added the code below to my shopify product.liquid  and added tag " hide" on my product but I'm still seeing pricing on all my products. I was hoping with this condition, I can hid pricing on some of my collections. I have tire a true condition such as 1 == 1 and the condition works but condition with tag is not working. I'm not sure what I'm missing in setting proper tag 

 

{% if product.tags contains "Hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

I appreciate help

Accepted Solutions (3)

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

Hi @nmaryami 

In Shopify 2.0 themes, the product card snippet assigned some values to these options.

Kindly share your theme name to check it further.

 

If you're using Shopify Dawn theme, you can use the below code.

 

 

{% if card_product.tags contains "Hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

Working snap:

Sheesh_b_0-1663615077752.png

 

Let us know if this code solve your issue.

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION

View solution in original post

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

Hi @nmaryami 

You're using the wrong line of codes. Try instead below code.

{% if card_product.tags contains "hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION

View solution in original post

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

@nmaryami 

Kindly try my code once. You're using the wrong code.

{% if card_product.tags contains "hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION

View solution in original post

Replies 14 (14)

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

Hi @nmaryami 

In Shopify 2.0 themes, the product card snippet assigned some values to these options.

Kindly share your theme name to check it further.

 

If you're using Shopify Dawn theme, you can use the below code.

 

 

{% if card_product.tags contains "Hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

Working snap:

Sheesh_b_0-1663615077752.png

 

Let us know if this code solve your issue.

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION
nmaryami
Excursionist
21 2 6

Hello,

Thank you for your quick response. I'm using Crave Theme

 

Thanks

nmaryami
Excursionist
21 2 6

I'm using the same code but it doesn't work

Sheesh_b
Shopify Partner
523 116 120

Hi @nmaryami 

On card-product.liquid, line number 197. I added the code shared above, and it's working at my end.

Sheesh_b_0-1663621546332.png

 

Sheesh_b_1-1663621573768.png

 

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION
nmaryami
Excursionist
21 2 6

Hello @Sheesh_b 

I'm not sure then what is wrong on my end. something about how to add tags, maybe. But I tried different tag names and it has the same result

 

Thanks

 

Sheesh_b
Shopify Partner
523 116 120

Hi @nmaryami 

Tags are case-sensitive.
If you added Hide tag, then use it as it is in the code, else use hide if it is 'hide'.

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION
nmaryami
Excursionist
21 2 6

Hi @Sheesh_b 

 

here is the screen shot of my tags and code

nmaryami_0-1663622152208.pngnmaryami_1-1663622349470.png

 

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

Hi @nmaryami 

You're using the wrong line of codes. Try instead below code.

{% if card_product.tags contains "hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION
nmaryami
Excursionist
21 2 6

Hello @Sheesh_b 

Thank your your help. All is good

 

Thank you

 

nmaryami
Excursionist
21 2 6

Hello @Sheesh_b 

Here is the screenshots on my code and tag

nmaryami_0-1663621931316.png

 

Sheesh_b
Shopify Partner
523 116 120

This is an accepted solution.

@nmaryami 

Kindly try my code once. You're using the wrong code.

{% if card_product.tags contains "hide" %}
<div class="ProductItem__PriceList Heading">
Price on demand only
</div>
{% else %}
<div class="ProductItem__PriceList Heading">
{% render 'price', product: card_product, price_class: '' %}
</div>
{% endif %}

 

We're here to simplify website creation for those looking to establish a strong online presence. Book a meeting slot if you want to discuss. It's FREE. BOOK NOW | Try Shopify for $1 for 3 Months: Shopify Trial | Shopify Web Store Developer |
LIKE or mark as ACCEPTED SOLUTION
atentosap
Tourist
7 0 1

Hi ! how are you

I used this code 
And then in every product I dont want to see the price I put "hide" but the prices still appear... do you know whats going on?

rasgc
Visitor
1 0 0

This worked perfectly on the Shopify free them Refresh. Thank you.

atentosap
Tourist
7 0 1

is it possible to hide the price just in some products? 
I used this code and all the prices in my website desappeared
price {
display: none;
}

But I want the price in some of them. Thanks