Refunded Line Items

This snippet supports updated line items (e.g. refunded items).

{% assign refund_lis = "" %}
{% for refund in order.refunds %}
  {% for rli in refund.refund_line_items %}
    {% assign refund_lis = refund_lis | append: rli.line_item_id | append: "," %}
  {% endfor %}
{% endfor %}
{% assign refund_lis = refund_lis | split: "," %}

<table class="line-items">
  <tr>
    <th colspan="3">ITEMS</th>
    <th>QUANTITY</th>
  </tr>
  {% for line_item in order.line_items %}
        {% assign skip = false %}
    {% if refund_lis contains line_item.id %}
      {% assign skip = true %}
    {% endif %}
        {% for p in line_item.properties %}
      {% if p.first == "_gs_bundle_item" %}
        {% assign skip = true %}
      {% endif %}
    {% endfor %}
    {% if skip == true %}
      {% continue %}
    {% endif %}
    <tr>
      <td style="width: 65px;">
        <img src="{{ line_item.image }}" alt="" onerror="this.onerror=null;this.src='https://cdn.shopify.com/s/files/1/0533/2089/files/placeholder-images-collection-1_large.png?format=webp&v=1530129113';" />
     </td>
     <td>
        <p>{{ line_item.title }}</p>
        <p>{{ line_item.variant_title }}</p>
        {% for p in line_item.properties %}
          {% if p.first == "_gs_bundle_contents" %}
                <p style="font-weight: 600;">Bundle contents:</p>
            <ul style="list-style: inside;">
              {% for bundle in p.last %}
                <li style="font-weight: 300;">{{ bundle | replace: "- Default Title ", "" }}</li>
              {% endfor %}
            </ul>
          {% endif %}
        {% endfor %}
     </td>
    <td>
        <p style="text-align: right;">{{ line_item.sku }}</p>
     </td>
     <td style="width: 75px;">
        <p>{{ line_item.quantity }}</p>
      </td>
    </tr>
  {% endfor %}
</table>

Can't find the answer in our documentation?
Contact Support