Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I've been attempting to use basic line item conditions in my order confirmation email but I consistently receive no output in my test emails.
I feel like I'm missing something fundamental because what I'm attempting seems trivial. I've been poking around the forums and YouTube but I can't seem to get the right leads on this topic.
Below are some examples of basic conditions I've tried. Any help/tip is appreciated!
Example #1
{% if line.product.vendor contains 'Amazon' %} Vendor is Amazon! {% endif %}
Example #2
{% if line.product.title == 'Test' %} Product's title is Test! {% endif %}
⭐️ Update:
After much testing I found that if I sandwiched the above examples between the following code it works!
{% for line in subtotal_line_items %}
{% endfor %}
Though I don't know why. Thoughts anyone?
Solved! Go to the solution
This is an accepted solution.
Hello, Hugo_Jones.
Basically, what your first two pieces of code were doing was:
If line item has/is this, do that
the problem is that line item wasn't defined anywhere.
When you add
{% for line in subtotal_line_items %}
{% endfor %}
you are looping through the existent subtotal line items, which are already defined, and you are defining each item being looped with the name 'line', that you were already using, then, you do this
If line item has/is this, do that
verification for each one of the line items, that's the reason that it works now. Let me know if I was clear enough
This is an accepted solution.
Hello, Hugo_Jones.
Basically, what your first two pieces of code were doing was:
If line item has/is this, do that
the problem is that line item wasn't defined anywhere.
When you add
{% for line in subtotal_line_items %}
{% endfor %}
you are looping through the existent subtotal line items, which are already defined, and you are defining each item being looped with the name 'line', that you were already using, then, you do this
If line item has/is this, do that
verification for each one of the line items, that's the reason that it works now. Let me know if I was clear enough
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025