Is there a way to filter the email message Line Items that are included in a Flow?

Topic summary

A user needed to filter line items in a Shopify Flow email to display only products matching specific criteria (vendor name) rather than all order items.

Solution Provided:
Another user suggested adding a conditional {% if %} statement within the line items loop to filter results. The syntax checks if a line item’s vendor matches the desired value before displaying it.

Implementation:
The original poster successfully implemented the solution by wrapping their line item display code with:

{% if lineItems_item.vendor == 'Vendor Name Here' %}

This filters the email to show only products from the specified vendor while iterating through draft order line items.

Status: Resolved - the filtering approach worked as intended.

Summarized with AI on November 4. AI used: claude-sonnet-4-5-20250929.

Hi,

I’m working on a Flow that will send an internal email whenever a certain type of product is present in an order. I have that working well using the Vendor Name condition. I am trying to only have it list the products that match the criteria (or a different one if need be) in the body of the email. Right now it is listing all of the products in the order (I’m testing this with Draft Orders so don’t mind that the variable name is off).

This is the code in the Message field of the Flow:

Draft Testing:  
Order {{draftOrder.name}}
Customer: {{draftOrder.customer.firstName}} {{draftOrder.customer.lastName}}
{% for lineItems_item in draftOrder.lineItems %}
  •{{lineItems_item.product.title}}
     -  {{lineItems_item.variant.title}}
{% endfor %}
1 Like

Yeah you can add

{% if lineItems_item.variant.title == 'X' %}

for example within the for loop.

1 Like

Thank you Kalen, that totally worked!

This is what I ended up with:

Draft Order Testing:  
Order {{draftOrder.name}}
Customer: {{draftOrder.customer.firstName}} {{draftOrder.customer.lastName}}
{% for lineItems_item in draftOrder.lineItems %}
  {% if lineItems_item.vendor == 'Vendor Name Here' %} 
  •{{lineItems_item.product.title}}
     -  {{lineItems_item.variant.title}}
   {% endif %}
{% endfor %}
1 Like

Sweet.