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” %}
Price on demand only
{% else %}
{% render 'price', product: card_product, price_class: '' %}
{% endif %}
I appreciate help
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" %}
Price on demand only
{% else %}
{% render 'price', product: card_product, price_class: '' %}
{% endif %}
Working snap:
Let us know if this code solve your issue.
Hello,
Thank you for your quick response. I’m using Crave Theme
Thanks
I’m using the same code but it doesn’t work
Hi @nmaryami
On card-product.liquid, line number 197. I added the code shared above, and it’s working at my end.
1 Like
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
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’.
Hi @Sheesh_b
here is the screen shot of my tags and code
Hi @nmaryami
You’re using the wrong line of codes. Try instead below code.
{% if card_product.tags contains "hide" %}
Price on demand only
{% else %}
{% render 'price', product: card_product, price_class: '' %}
{% endif %}
1 Like
Hello @Sheesh_b
Here is the screenshots on my code and tag
Hello @Sheesh_b
Thank your your help. All is good
Thank you
1 Like
@nmaryami
Kindly try my code once. You’re using the wrong code.
{% if card_product.tags contains "hide" %}
Price on demand only
{% else %}
{% render 'price', product: card_product, price_class: '' %}
{% endif %}
1 Like
rasgc
January 29, 2023, 2:18am
13
This worked perfectly on the Shopify free them Refresh. Thank you.
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
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?