Why is my order summary code invalid in Flow?

Why is my order summary code invalid in Flow?

NOMADCT
New Member
10 0 0

I'm trying to have an order summary: Order name, number, line items with variant purchased, quantity and image for said variant. 

 

{{order.customer.email}}
{{order.name}}
{% for li in order.lineItems %}
{% for li in line_item.variant %}
{{ line_item.image | img_url: 'small' | img_tag }}
{{ li.title }}
{% endfor %}

Replies 4 (4)

Dan-From-Ryviu
Shopify Partner
12018 2348 2527

Your code is missing another {% endfor %} at the end

- Helpful? Like & Accept solution! - Support me? Buy me a coffee
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

paul_n
Shopify Staff
1817 199 432

It's also using {% for li in line_item.variant %} when line_item is not defined as a variable

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
NOMADCT
New Member
10 0 0

So something like this? 

{{order.customer.email}}
{{order.name}}
{% for li in order.lineItems %}
{item.variant}
{{ line_item.image | img_url: 'small' | img_tag }}
{{ li.title }}
{% endfor %}

{% endfor %}

 

paul_n
Shopify Staff
1817 199 432

No. When you loop over a list, that "li" part is the single item for that iteration of the loop. So if you want to access line item info, you need to use that li. You also have a second closing {% endfor %} for no reason. To learn the basics, I definitely recommend you read up on liquid more here

 

I'll add that I'm guessing you copy/pasted this code... Flow does not support the exact same liquid as themes, so when you use tags like "img_url" and "img_tag" make sure to confirm they work, because I don't think they are supported in the variant of liquid that Flow uses. I substituted the "URL" field for those tags. This at least passes validation:

 

 

{{order.customer.email}}
{{order.name}}
{% for li in order.lineItems %}
{li.variant}
{{ li.image.url }}
{{ li.title }}
{% endfor %}

 

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.