some help

neomi
New Member
3 0 0

i add to my turbo theme product-form.liquid a text and i want its appear only in collection i want

some know how i can do?

 

0 Likes
Guleria
Shopify Partner
1255 263 345

Hello,

Use this ( paste in top of product-form.liquid )

 

{% assign has_z = 0 %}
{% for collection in product.collections %}
  {% if collection.handle == 'your-collection-handle' %}
      {% assign has_z = has_z | plus: 1 %}
  {% endif %}
{% endfor %}

 

 Note: Change 'your-collection-handle'  to actual you collection handle

now wrap your text in this condition

{% if has_z >= 1 %}
// Your text will go here
{% endif %}

 

Thanks 

Want to modify or custom changes on store hire me.
Email: guleriathakur43@gmail.com, Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate Click here (Its my paypal)
0 Likes
neomi
New Member
3 0 0

thank you for your help i tring to do it and i want its only on a cuople of collections

0 Likes
Guleria
Shopify Partner
1255 263 345

If you want to use it with multiple collection then use logical 'or' operator. 
Here you can check more about logical operator.

Want to modify or custom changes on store hire me.
Email: guleriathakur43@gmail.com, Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate Click here (Its my paypal)
0 Likes
neomi
New Member
3 0 0

tring to exclued this one

{% if collection.handle not contains "rings" or "bracelets" or "necklaces"%}

but its not showing on any product

0 Likes