net price for order

Highlighted
Shopify Partner
8 0 1

I couldn't find a variable for total net price (total price including products, shipping, discounts without tax being applied).

 

Eventually worked this out which works on order printer app.

 

{{ total_price | minus:tax_price | money }}

 

Sounds simple but took me a while to figure out and there isn't any mention for net price in help or the community so thought id share and maybe help others in future looking for the answer I was. 

1 Like
New Member
2 0 1

shopify completed my request to customize the order printer template for refund to display the appropriate tax amount for the refund transaction.

I set up a separate template for refunded items.

 

The refund transactions do not include a tax amount variable to display when the taxes are included in the prices.

Here is the rough formula that the shopify system uses to calculate the amount of tax that is being included in the prices which is:
PRICE / (TAX RATE + 100) * TAX RATE

This is roughly how the system calculates it. The actual process is being done with code that is way more complex as it calculates it on each single item first adds the entire values together with the run on decimals and then at the very end it rounds it. This has been found to only cause a penny discrepancy between the above formula and what is in the admin in very rare cases.

 

how to list your refunded items with refunded prices -

<table class="table-tabular" style="margin: 0 0 1.5em 0; border: none;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>

<th>Unit Price</th>

<th>Total</th>
</tr>
</thead>
<tbody>


{% for refund in refunds %}

{% for refund_line_item in refund.refund_line_items %}
<tr>
<td>{{ refund_line_item.quantity }} x </td>
<td><strong>{{ refund_line_item.line_item.title }}</strong></td>
<td> {{ refund_line_item.line_item.price | money }} </td>
<td> {{ refund_line_item.line_item.price | times: refund_line_item.quantity | money }} </td>
</tr>
{% endfor %}
{% endfor %}

</tbody>
</table>

 

 

this is how to display the refund total with net and tax for the refunded amount not the total order amount.-

 

<h3 style="margin: 0 0 1em 0;">Refund Payment Details</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0; border: none;">
{% for transaction in refund_transactions %}
{% assign tax_amount = transaction.amount | divided_by: 120.000 | times: 20.000 %}
<tr>
<td>Total tax:</td>
<td>{{ tax_amount | money }}</td>
</tr>
<tr>
<td>Refund net:</td>
<td>{{ transaction.amount | minus: tax_amount | money }} </td>
</tr>
<tr>
<td> <strong> {{ transaction.kind }}</strong></td>

<td><strong> {{ transaction.amount | money }}</strong></td>
</tr>
{% endfor %}
</table>

0 Likes