How can I fix data pull issues in custom HTML abandoned cart email?

We are currently creating a custom abandoned cart for our store using HTML and it is almost finished but we are having some difficulties pulling in data for a couple of line item properties. We need to add the line item compare at price (line.variant.compare_at_price) and the line url (line.url) but for some reason they are not working. We have already successfully added the line title (line.title) and line price (line.price) so I assume we have just missed a “capture” or “assign” somewhere. Please see our code below. Any help would be greatly appreciated.

@LitExtension

{% for line in subtotal_line_items %}
{% if line.product.title %}
{% assign line_title = line.product.title %}
{% else %}
{% assign line_title = line.title %}
{% endif %}
{% if line.quantity < line.quantity %}
{% capture line_display %} {{ line.quantity }} of {{ line.quantity }} {% endcapture %}
{% else %}
{% assign line_display = line.quantity %}
{% endif %}

<table>

<table>

<table>

<tr>

<td>

</td>

</tr>

</table>

<table>

<tr>

<td>

{{ line_title }}

</td>

</tr>

</table>
<table>

<tr>

<td>

**{{ line.price | money }}**   {{ line.compare_at_price | money }}

</td>

</tr>

</table>
<table>

<tr>

<td>

[View product](https://willos.co.uk/{{ line.url
}})

</td>

</tr>

</table>

</table>

</table>
<table>

<table>

<table>

<tr>

<td>

</td>

</tr>

</table>

<table>

<tr>

<td>

{{ line_title }}

</td>

</tr>

</table>
<table>

<tr>

<td>

**{{ line.price | money }}**   {{ line.compare_at_price | money }}

</td>

</tr>

</table>
<table>

<tr>

<td>

[View product](https://willos.co.uk/{{ line.url
}})

</td>

</tr>

</table>

</table>

</table>
{% endfor %}

Hi @willogroup ,

Refer https://help.shopify.com/en/manual/orders/notifications/email-variables/#line-item

It will support attributes including ‘line.variant.compare_at_price’ and ‘line.url’.

So I checked and you didn’t get ‘line.variant.compare_at_price’ correctly:

Hope it helps!

Hi @LitExtension ,

Thank you for getting back to us. We have already tried “line.variant.compare_at_price” and that doesn’t work either. Any ideas? We have already been using that webpage to find the correct variable but something about our code must be incorrect.

Hi @willogroup ,

If it doesn’t show, this is most likely no product in the subtotal. You can try adding products and checking again.

Because I checked and your code works fine.

Hope it helps!

@LitExtension

You’re right it looks like there is nothing wrong with my code after all. There must just be an issue with the test emails that were being sent by Shopify. Sorry for wasting your time!

Hi @willogroup ,

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.