Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Trying to add TOTAL line price to an Order Printer Invoice that I am converting to a COMMERCIAL INV

Trying to add TOTAL line price to an Order Printer Invoice that I am converting to a COMMERCIAL INV

NataliaM
Visitor
2 0 1

Hello

 

I a struggling!!

 

I have managed to work around adding all of the relevant details required for a legal Commercial Invoice except for adding HS CODES which apparently can't be done and now adding a TOTAL line item cost... I have to show "individual cost" or in my case pack cost AND the total of that line item cost. For example, a pack of 3 costs $20 but they have purchased 4 packs (of 3) so I must show Price $20 and TOTAL PRICE $80 .

 

I have managed to add the header but no matter what I do I can't find the right liquid info to add the TOTAL PRICE to each line. This is how the code looks now:

 

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
<th>Price</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td><b>{{ line_item.title }}</b></td>
<td>
{% if line_item.original_price != line_item.price %}
<s>{{ line_item.original_price | money }}</s>
{{ order_currency }}
{{ line_item.price | money }}
{% endif %}
{{ line_item.price | money }}
{{ product.price | money_with_currency }}
{{ order_currency }}
</td>
</tr>
{% endfor %}
</tbody>
</table>

 

And this is how that part of the invoice looks now:

NataliaM_0-1612306622945.png

 

Any help would be greatly appreciated!!!

 

Thanks!

 

Nat

Replies 6 (6)

themecaster
Excursionist
30 10 19

 

Hi Natalia,

The property I think you are looking for is line_item.final_line_price. 

All of the line_item properties can be found in this doc.

With that in mind here's what the code should look like:

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
<th>Price</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td><b>{{ line_item.title }}</b></td>
<td>
{% if line_item.original_price != line_item.price %}
<s>{{ line_item.original_price | money }}</s>
{{ order_currency }}
{{ line_item.price | money }}
{% endif %}
{{ line_item.price | money }}
{{ product.price | money_with_currency }}
{{ order_currency }}
</td>
<td>
{{ line_item.final_line_price | money_with_currency }}
</td>
</tr>
{% endfor %}
<tr>
	<td colspan="3" style="text-align: right;">Subtotal</td>
	<td style="text-align: right;">{{ cart.original_total_price | money_with_currency  }}</td>
</tr>
</tbody>
</table>

I took the liberty of adding the subtotal ;). You can easily remove it if you don't need it. 

Check out the cart docs if you have questions about the cart properties like subtotal, discounts, and total.

 

 

If my response was helpful please Like and Mark As Solution.
NataliaM
Visitor
2 0 1
Thank you!

I have copied and pasted the code you sent, spaced out, but it is still not
bringing up the total price for the line.

The description provided via the doc. is correct, that is exactly what I
need to show, but I can't get it to work.


Lixon_Louis
Shopify Partner
1193 35 268

 Try line_item.line_price  instead. The liquid variables are different for order printer app.

Shopify - Google Chrome 2021-02-03 18.01.28.png

FarinazWadia
Tourist
4 0 0

That fixed the line item total. Thank you!

FarinazWadia
Tourist
4 0 0

I found this MOST helpful! However, as Natalia mentions below, the line total did not show up. Also subtotal was blank.

I added in the line of code from Lixon_Louis below, and that fixed the line item total. 

Using your code above, and with a couple of modifications, my template now looks like this:

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
<th>Price</th>
<th>Total Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td><b>{{ line_item.title }}</b></td>
<td>
{% if line_item.original_price != line_item.price %}
<s>{{ line_item.original_price | money }}</s>
{{ order_currency }}
{{ line_item.price | money }}
{% endif %}
{{ line_item.price | money }}
{{ product.price | money_with_currency }}
{{ order_currency }}
</td>
<td>
{{ line_item.line_price | money_with_currency }}
</td>
</tr>
{% endfor %}
<tr>
<td colspan="3" style="text-align: right;">Subtotal</td>
<td style="text-align: right;">{{ subtotal_price | money }}</td>
</tr>
</tbody>
</table>

molemansd1
Visitor
2 0 0

I would like to do the same. I copied and pasted but it removed everything. I read above about op spacing it out. Do I need to do this? I don't know how.