Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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:
Any help would be greatly appreciated!!!
Thanks!
Nat
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.
Try line_item.line_price instead. The liquid variables are different for order printer app.
That fixed the line item total. Thank you!
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>
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.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024