What's your biggest current challenge? Have your say in Community Polls along the right column.

How to add descriptions to specific featured collections but not all - Dawn Theme

How to add descriptions to specific featured collections but not all - Dawn Theme

andrew72
Excursionist
30 0 7

Hi, 

 

I found the correct placement and code to display the descriptions for all featured collection products.

 

I am trying to add descriptions to products in specific collections and would like to leave other collections out of this.

 

What line of code would I use to do this?

 

Thanks in advance.

 

 

Replies 2 (2)
andrew72
Excursionist
30 0 7

Hi Mia,

 

Sorry this might not have been clear.

 

I am trying to have product descriptions show for a certain featured collection.

 

Thanks for any help.

Odunola
Shopify Partner
16 2 4

To display descriptions for products in specific collections while excluding others, you can use a conditional statement in your code. Here’s a general approach:

Identify the Collection: You’ll need the collection handle (a unique identifier for your collection). You can find this in your Shopify admin under the collections section.

Add Conditional Logic: In your code where you’re displaying product descriptions, add a conditional check for the collection handle. Here's a sample code snippet:

liquid
Copy code
{% if collection.handle == 'your-specific-collection-handle' %}
{{ product.description }}
{% endif %}
Replace 'your-specific-collection-handle' with the actual handle of the collection where you want descriptions to appear.

For Multiple Collections: If you want to include descriptions for multiple collections, you can use the or operator:
liquid
Copy code
{% if collection.handle == 'first-collection-handle' or collection.handle == 'second-collection-handle' %}
{{ product.description }}
{% endif %}
Placement: Make sure to place this code where the product information is being rendered in your theme.
This way, descriptions will only show for products in the specified collections. If you have more collections, you can continue adding them in the conditional logic. 

If my suggestion works for you, please give it a Like or mark it as a Solution
Feel free to reach out to me
Email : adeniyiblessing888@gmail.com
WhatsApp [wa.me/+2347047775840]