Skip to main content
Solved

Parsing Shopify product tags in Abandon Cart to display a specific tag of the comma separated tag list

  • April 17, 2025
  • 3 replies
  • 65 views

Forum|alt.badge.img+3

Using this variable in an abandoned cart email:

{{ event.extra.line_items.0.product.tags|default:'' }}

The output value is this:

Australia, CEUS:2.4 IACET CEUs, Dates: Apr. 1 - 10 2025, Duration: 12 weeks, Format: On-Site, Language: English, Location: Virtual, Region: All, show_upsell, Type: COSP F

Within that I don’t need to display all the tags as they make no sense to a user.  Instead we need to parse out specific tags such as  "Location: XXX". 

Do you know how to parse for value matches inside this comma-separated list?  For instance, I don't need "CEUS: 2.4 IACET CEUs" tag #1 but I do need "Dates:" and "Location:" and "Duration:" tags in the email. The tags are all based on a naming convention prefix such as “Language: value” or “Type: value”.

Best answer by Byrne C

Hey ​@gbpenn,

Welcome to the community, and thanks for the question. I believe that you can use the |lookup: filter to look up items at certain positions in a list.

For example, if you add |lookup:1 to your variable, it will look like this:

{{ event.extra.line_items.0.product.tags|lookup:1 }}

This will look at the first item in the list, and display that item only, so in your case, it’ll display Australia. Reference to this on our Django filter glossary here.

Let me know if this works, or if I can answer any additional questions regarding this.

-Byrne

3 replies

Byrne C
Community Manager
Forum|alt.badge.img+28
  • Community Manager
  • Answer
  • April 18, 2025

Hey ​@gbpenn,

Welcome to the community, and thanks for the question. I believe that you can use the |lookup: filter to look up items at certain positions in a list.

For example, if you add |lookup:1 to your variable, it will look like this:

{{ event.extra.line_items.0.product.tags|lookup:1 }}

This will look at the first item in the list, and display that item only, so in your case, it’ll display Australia. Reference to this on our Django filter glossary here.

Let me know if this works, or if I can answer any additional questions regarding this.

-Byrne


Forum|alt.badge.img+3
  • Author
  • Contributor I
  • April 18, 2025

Thanks.  Can I lookup not by the # in the list but by value?  In other words, could I search for “location:*” amongst the values?


Byrne C
Community Manager
Forum|alt.badge.img+28
  • Community Manager
  • April 22, 2025

Unfortunately, that’s not possible at this time. Apologies for this - I definitely see how this could be useful and I’m happy to reach out to our product team and recommend that we implement this in the future.