Shopify themes, liquid, logos, and UX
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.
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.
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.
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025