Adding Product Image to Confirmation Email

New Member
9 0 0

Is it possible to add the actual product image that the customer purchased in the confirmation email? If so, can you provide the cart variable? I looked at the cart.attributes section in WIKI and could not find any reference to the images...

Thanks in advance for your help :)


Replies 28 (28)
Shopify Partner
1264 9 104

Take a look at Line Item. You can access the product images, so you would need something like this:


{{ item.product.featured_image |  product_img_url | img_tag }}

New Member
9 0 0

Thanks for the response BBG but that just gave me a broken image in the email.... do you have any other ideas? :)

Shopify Staff
5705 1 357


Gavin's solution is the correct one. Maybe your email template uses line instead of item. That's a variable defined by the code in the template. Try what follows. Also make sure to include the code in the right place, INSIDE the for loop:

{{ line.product.featured_image |  product_img_url | img_tag }}

Caroline_Schnap | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Shopify Partner
49 0 3

Hi Caroline and lisaB,

This post really helped me out with the product image in the html confirmation email. My template uses "line" and not "item" and the above code worked perfectly.

In the "line" case, how would I be able to get the total price for the line item?

obviously, line_item.line_price does not work for me. :(

Thanks for your help!

Shopify Partner
49 0 3

i figured it out. it's:

{{ line.line_price | money }}

i'm so glad that there's an html email confirmation! when i put up my first shopify store 3 years ago, i struggled so badly with the plain text because I needed it to be in Hebrew and right to left support was a problem. no longer!



New Member
13 0 0

I was wondering what if I want it to show that particular line_item (variant) image. can i use any of the following?


{{ line.product.images[1] |  product_img_url | img_tag }}

or do i have to do something like this?


{% assign index = 0 %}
{% for variant in line_item.variant.option1 %}
{% if variant.title == line.title %}
{% assign index = forloop.index0 %}
{% endif %}
{% endfor %}

{{ line.product.images[index] |  product_img_url | img_tag }}




5 0 1

Has anyone been able to get these e-mails to work with the variant image as namsterdamus asked about?

I followed the instructions but the images on my e-mails are broken too, however I also want to show the exact color that the customer orders as well.

New Member
17 0 0

I was looking into the same question.

What is the variable for the product variant image to be used on the email template?

14 0 6

Hi All,

Hopefully this will help someone as it was driving me crazy. I've just managed to get my order confirmation emails to show the variant images - tested by purchasing 2 variants of the same product and my confirmation emailed showed both the colours I ordered.

here is the code I used: {{ line | img_url: 'medium' }}

so the full line of code is: 

<img align="right" alt="line.title" class="kmImage" src="{{ line | img_url: 'medium' }}" width="180" style="border:0;height:auto;line-height:100%;outline:none;text-decoration:none;padding-bottom:0;display:inline;vertical-align:bottom;margin-left:0;max-width:180px;" />

Now I did use Klaviyo to build my template (available in the app store), exported it and pasted it into Shopify - do not know if this makes a difference, but its worked for me, I use Klaviyo's full email marketing software (highly recommended) but I believe they have a HTML template app available for free.

Also and this is just an educated guess, I imagine that if you have variants of a product, in order to show the variant image in your emails, you will need to set the image for each product variant on the product upload page itself (sorry if this sounds obvious but it may help people new to Shopify - I've not tested it though so dont know for sure!)

I'd love to know if this works for others!


Have a great weekend