How can I use the line_item.final_price variable in order printer invoices?

Hi there!

Could someone give me an example of how to use the line_item.final_price variable/object on the regular order printer invoice?

I tried displaying it like this but the column is empty in the resulting invoice:

{% for line_item in line_items %}
{% if line_item.title == ‘Tip’ %}
{% assign tip_amount = line_item.price %}
{% else %}

{{ line_item.quantity }} x {{ line_item.sku }} {{ line_item.title }} {{ line_item.final_price | money }}

Maybe you can give me a code example, how I can use this line_item.final_price values?

Hi, everything looks good to me except you’re missing an “{% endif %}” at the end of the if/else statement.

Here’s more info on how liquid handles if/else statements. I hope this helps. Good Luck.

Hi bdowling, thanks for the quick reply!

I had the {% endif %} statement included, I just forgot to post it here. I am using this on my Invoice template and I think it is not possible to include this on invoices in general, but I am not sure.

Do you know how to access discount shares from a fixed amount discount included on a single item?

That may be the case. It looks like line_items always at least have a key property. If that still doesn’t display, it may be a limitation of the invoice.

As far as “how to access discount shares from a fixed amount discount included on a single item”… I’m not sure what you mean. Do you mean derive the percent discount from a fixed dollar discount?

It doesn’t look like Order Printer has the same access to the line_item object as you do in other places while editing the site. It looks like line_price is what you’re looking for but I’m not sure since I haven’t tested it. Then there is line_item.original_price and line_item.total_discount which should get your discount for your line item: