Skip to main content
Solved

Image Not Showing on Abandon Cart

  • October 16, 2024
  • 3 replies
  • 81 views

Forum|alt.badge.img
  • Contributor I
  • 1 reply

I am making an abandon cart email that should display the image from the first item that was abandoned in the cart.

For some reason the product image will only show up for certain order, and is missing for others (see images below).

I also included an image of the code for the dynamic image, here it is in plain text:
{{ event.extra.line_items.0.product.variant.images.0.src }}

Can anyone help to fix this issue so the image will show up?

 

Email Formatting
Missing Product Image
​​​​​​
What it should look like
Dynamic Image Code

 

Best answer by JJSI

@annasophiefc thanks so much for that response, while it didn’t 100% work it lead me to the correct solution which I cant thank you enough for. Really appreciate the help! Here is what the final code looked like to get the first image from what is shown in the cart:

{% if event.extra.line_items.0.product.variant.images.0.src %}   {{ event.extra.line_items.0.product.variant.images.0.src }} {% else %}   {{ event.extra.line_items.0.product.images.0.src }} {% endif %}

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

annasophiefc
Partner - Platinum
Forum|alt.badge.img+22
  • 2025 Champion
  • 101 replies
  • October 18, 2024

Hi @JJSI 

 

Thank you for posting in the Community! 

 

I could appear that you are using the static syntax instead of the dynamic syntax for the cart block.

 

{{ event.extra.line_items.0.product.variant.images.0.src }}

in a dynamic block would become

 {{ item.product.variant.images.0.src }}.

 

If the abovementioned doesn’t work try this one:

 

{% if item.product.variant.images.0.src %}{{item.product.variant.images.0.src}}{%else%}{{item.product.images.0.src|missing_product_image}}{%endif%}

 

I hope this helps!


Forum|alt.badge.img
  • Author
  • Contributor I
  • 1 reply
  • Answer
  • October 24, 2024

@annasophiefc thanks so much for that response, while it didn’t 100% work it lead me to the correct solution which I cant thank you enough for. Really appreciate the help! Here is what the final code looked like to get the first image from what is shown in the cart:

{% if event.extra.line_items.0.product.variant.images.0.src %}   {{ event.extra.line_items.0.product.variant.images.0.src }} {% else %}   {{ event.extra.line_items.0.product.images.0.src }} {% endif %}


chloe.strange
Community Manager
Forum|alt.badge.img+41
  • Community Manager
  • 429 replies
  • November 1, 2024

@JJSI

Thanks for sharing back your solution, it helps so many others in our community! 

~Chloe