Skip to main content

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

 

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!


@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 %}


Reply