Adding Refund $ line to payment details in Order Printer app

Adding Refund $ line to payment details in Order Printer app

Ajevie
Tourist
8 0 1

Looked EVERYWHERE trying to find the correct coding to add a "Refunded Amount" line to the Payment details in my Order Printer template...

 

Current Code
<h3 style="margin: 0 0 1em 0;">Payment Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<tr>
<td>Subtotal price:</td>
<td>{{ subtotal_price | money }}</td>
</tr>
{% if shipping_address %}
<tr>
<td>Shipping:</td>
<td>{{ shipping_price | money }}</td>
</tr>
{% endif %}
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} {{ tax_line.title }}<br/>
{% endfor %}
</td>
{% endif %}
<tr>
<td>Total tax:</td>
<td>{{ total_tax | money }}</td>
</tr>
</td>
<tr>
<td><strong>Total price:</strong></td>
<td><strong>{{ total_price | money }}</strong></td>
</tr>
{% for discount in discounts %}
<tr>
<td>Includes discount "{{ discount.code }}"</td>
<td>{{ discount.savings | money }}</td>
</tr>
{% endfor %}
{% if total_paid != total_price %}

<tr>
<td><strong>Total paid:</strong></td>
<td><strong>{{ total_paid | money }}</strong></td>
</tr>
{% endif %}
</table>

Reply 1 (1)

karnkumarverma
Visitor
1 0 0

<h3 style="margin: 0 0 1em 0;">Payment Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<tr>
<td>Subtotal price:</td>
<td>{{ subtotal_price | money }}</td>
</tr>
{% if shipping_address %}
<tr>
<td>Shipping:</td>
<td>{{ shipping_price | money }}</td>
</tr>
{% endif %}
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} {{ tax_line.title }}<br/>
{% endfor %}
</td>
{% endif %}
<tr>
<td>Total tax:</td>
<td>{{ total_tax | money }}</td>
</tr>
<tr>
<td><strong>Total price:</strong></td>
<td><strong>{{ total_price | money }}</strong></td>
</tr>
{% for discount in discounts %}
<tr>
<td>Includes discount "{{ discount.code }}"</td>
<td>{{ discount.savings | money }}</td>
</tr>
{% endfor %}

{% assign refunded_amount = 0 %}
{% for transaction in transactions %}
{% if transaction.kind == 'refund' %}
{% assign refunded_amount = refunded_amount | plus: transaction.amount %}
{% endif %}
{% endfor %}

{% if refunded_amount > 0 %}
<tr>
<td>Refunded Amount:</td>
<td>{{ refunded_amount | money }}</td>
</tr>
{% endif %}

{% if total_paid != total_price %}
<tr>
<td><strong>Total paid:</strong></td>
<td><strong>{{ total_paid | money }}</strong></td>
</tr>
{% endif %}

{% assign outstanding_amount = total_price | minus: refunded_amount | minus: total_paid %}

{% if outstanding_amount > 0 %}
<tr>
<td><strong>Outstanding Amount:</strong></td>
<td><strong>{{ outstanding_amount | money }}</strong></td>
</tr>
{% endif %}
</table>