How to send different fulfillment emails based on product type?

Topic summary

Goal: include a certificate in fulfillment emails only when the order contains jewelry products, identified by titles containing “Colier.”

Key issue: the Liquid condition {% if line.title contains ‘Colier’ %} didn’t work because it must run within the line items loop, or logic must aggregate the check across items.

Recommended solutions (Shopify Liquid):

  • Place the condition inside the loop:
    • {% for line in line_items %} … {% if line.title contains ‘Colier’ %} show certificate … {% endif %} {% endfor %}
  • Or set a flag outside the loop:
    • Initialize a variable (e.g., certificate = false), iterate over line_items to set it true if any line.title contains “Colier”, then after the loop: {% if certificate %} show certificate {% endif %}.

Technical notes: uses Shopify email template variables (line_items, line.title) and Liquid’s contains string match.

Outcome: after applying the loop/flag approach, the certificate logic worked. No weight-based workaround needed. Status: resolved.

Summarized with AI on January 4. AI used: gpt-5.

I want to send 2 different fulfillment emails.

If a customer purchases jewelry, ONLY THEN, I want to send them a certificate as well.

All the jewelry titles contain the word “Colier”
So, in the email template, I set up this condition but it doesn’t work.
Any ideas? Have I missed something? Or do you know another workaround?! Like a weight condition or idk

{% if line.title contains ‘Colier’ %}
text here
{% endif %}

really? no one can help?

The variable looks right according to the documentation: https://help.shopify.com/en/manual/orders/notifications/email-variables#line-item

Check to make sure that piece of code you shared is inside the line items loop.

Example:

{% for line in line_items %}
your code here
{% endfor %}

If you don’t want to add the certificate for every jewelry item, or you want to add in a place other than inside the line items loop, you could do something like this:

{% assign certificate = false %}

{% for line in line_items %}
  {% if line.title contains "Colier" %}
    {% assign certificate = true %}
  {% endif %}
{% endfor %}

{% if certificate %}
show the certificate info here
{% endif %}

Many many many many thanks!
it works!
again tyvm sir!

1 Like