Custom title in product grid, include tag

I am using the sense theme. I would like to add a line of text under the title in the product grid. The only way I can think of doing this would be to add custom text to the products tag.

My product may have multiple tags (comma separated, imported through a csv file). Would it be possible to show the title within the product grid, followed by a carriage return, and one of the tags (say the second tag). If you can’t split the tags in this way then I would just have a single tag per product.

I am new to shopify, but it looks as though main-collection-product-grid.liquid could be the file I need to alter. As anyone done anything like this before? If so could you please share the required code.

Thanks in advance,

Martin.

First, open the “main-collection-product-grid.liquid” file in your theme editor.

Find the section of code that displays the product title in the grid. This should be a line that looks something like this:

## {{ product.title }}

Directly below this line, add the following code:

{% if product.tags.size > 1 %}
{{ product.tags[1] }}

{% endif %}

code checks if the product has more than one tag (using the “size” property of the tags array), and if it does, it displays the second tag (using the array index notation).