Help me output {{ customer.tags }}

Explorer
68 0 4

Hi!

 

I have three tags for every customer. Tag 1, Tag 2, Tag 3.

 

I know how to output Tag 1 and Tag 3 using {{ customer.tags.first }} and {{ customer.tags.last }}, but how do I output Tag 2? If I want to create more than 3 tags, can you help me understand the logic beyond first and last? Are tags numbered?

 

Thanks!

0 Likes
Highlighted
Explorer
68 0 4

Okay, I just solved my issue by reading up on array filters here

 

For anyone interested, {{ customer.tags[1] }} outputs the 2nd tag because it starts with 0, 1, 2, 3, 4, 5, etc...

0 Likes
Highlighted
Excursionist
29 6 12

Hi,

you can used below code for all customer tags.

{% if customer %}
{% for tag in customer.tags %}
<p>{{ tag }}</p>
{% endfor %}
{% endif %}

Thanks & Regards
rbdtechworld

Would like to add new functionality or customize an existing one, please hire us.
If helpful then please Like and Accept Solution .
Email: developer9it@gmail.com

0 Likes