Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I've upgraded to the new order printer app (previously using the legacy version) and a part of my invoice code is no longer working.
It's meant to leave a note on the invoice when customers leave a tip, we donate this to charity and want to thank the customer.
This is the code on the old invoice, what needs updating please?
<td>{% unless line_item.title contains 'Tip' %}<b>{{ line_item.title }}</b>
{% else %}<b>Thanks for your donation to akt!</b>{% endunless %}
<br>{{ line_item.sku }}</td>
Solved! Go to the solution
This is an accepted solution.
So apparently miracles can happen - I got the answer I needed from Shopify support! 🥳
They wrote this, have added it to the totals summary at bottom of invoice
{% if order.total_tip > 0 %}
<tr>
<td colspan="3" style="text-align: right;">Charity Donation</td>
<td style="text-align: right;">{{ order.total_tip | money }}</td>
</tr>
<tr>
<td colspan="4" style="text-align: right;"><b>❤ Thanks for your donation to akt! ❤</b></td>
</tr>
{% endif %}
works perfectly 👍
Thanks Randy @ Shopify!
Hard to tell 100% but the code works fine for me if it's inside the {% for line_item in order.line_items %} loop (where I guess you have it as well).
yeah it's within that loop. proper chin scratcher! 🤔
My code (I'm checking just for 'i' -- maybe it's case-sensitivity?):
{% unless line_item.title contains 'i' %}--i <b>{{ line_item.title }}</b>
{% else %}++-i <b>Thanks for your donation to akt!</b>{% endunless %}
<br>{{ line_item.sku }}
Result:
Have tried different cases for 'Tip' no dice I'm afraid!
Would you be comfortable posting your entire template so that I or others could look a bit deeper into your issue?
Another user posted about an identical issue a couple days ago (https://community.shopify.com/c/shopify-discussions/new-order-printer-tip-code-help-shopify-support-...) - I tried to help them but had no luck. I figured it must have been a one-off fluke, but now that you have asked the exact same question I am super curious as to what could be causing it. it is just a bit difficult to diagnose without having the full template to look at.
sure!
<div>
<div class="columns">
<div style="float: left; margin: 0 0 1.5em 0;" >
<img src="https://cdn.shopify.com/s/files/1/0087/8090/6558/files/Luna_Website_Logo_efdfaae7-3dff-4fe1-9138-35e5bf225654.png" width="20%"></div>
<div>
<p style="text-align: right; margin: 0;">
Order {{ order.order_name }}<br />
{% if order.po_number %}PO # {{ order.po_number }}<br />{% endif %}
{{ "now" | date: "%B %e, %Y" }}
</p>
</div>
</div>
<div class="columns" style="margin-top: 1.5em;">
<div class="address">
<strong>From</strong><br/>
{{ shop.address | format_address }}
</div>
{% if order.shipping_address %}
<div class="address">
<strong>Ship to</strong>
{{ order.shipping_address | format_address }}
{% if order.shipping_address.phone %}{{ order.shipping_address.phone }}{% endif %}
</div>
{% endif %}
</div>
<table class="table-tabular" style="margin: 1em 0 0 0;">
<thead>
<tr>
<th>Qty</th>
<th></th>
<th>Item</th>
<th style="text-align: right;">Price</th>
</tr>
</thead>
<tbody>
{% for line_item in order.line_items %}
<tr>
<td><b>{% unless line_item.title contains 'Tip' %} {{ line_item.quantity }} x {% endunless %}</b></td>
<td>{{ line_item.product.featured_image | product_img_url: 'thumb' | img_tag }}</td>
<td>{% if line_item.title contains 'Tip' %}
<b>Thanks for your donation to akt!</b>
{% else %}<b>{{ line_item.title}}</b>
{% endif %}
<br>{{ line_item.sku }}</td>
<td style="text-align: right;">{{ line_item.price | money }}</td></b>
</tr>
{% endfor %}
<tr>
<td colspan="3" style="text-align: right;">Subtotal</td>
<td style="text-align: right;">{{ order.subtotal_price | money }}</td>
</tr>
{% for discount in order.discounts %}
<tr>
<td colspan="3" style="text-align: right;">Includes discount {% if discount.code %}"{{ discount.code }}"{% endif %}</td>
<td style="text-align: right;">{{ discount.savings | money }}</td>
</tr>
{% endfor %}
<tr>
<td colspan="3" style="text-align: right;">Tax</td>
<td style="text-align: right;">{{ order.tax_price | money }}</td>
</tr>
{% if order.shipping_address %}
<tr>
<td colspan="3" style="text-align: right;">Shipping <B>({{ order.shipping_method.title }})</B></td>
<td style="text-align: right;">{{ order.shipping_price | money }}</td>
</tr>
{% endif %}
<tr>
<td colspan="3" style="text-align: right;"><strong>Total</strong></td>
<td style="text-align: right;"><strong>{{ order.total_price | money }}</strong></td>
</tr>
{% if order.net_payment != order.total_net_amount %}
<tr>
<td colspan="3" style="text-align: right;">Total Paid</td>
<td style="text-align: right;">{{ order.net_payment | money }}</td>
</tr>
{% endif %}
{% if order.total_refunded_amount > 0 %}
<tr>
<td colspan="3" style="text-align: right;">Total Refunded</td>
<td style="text-align: right;">{{ order.total_refunded_amount | money }}</td>
</tr>
{% endif %}
{% if order.net_payment != order.total_net_amount %}
<tr>
<td colspan="3" style="text-align: right;"><strong>Outstanding Amount</strong></td>
<td style="text-align: right;"><strong>{{ order.total_price | minus: order.net_payment | money }}</strong></td>
</tr>
{% endif %}
</tbody>
</table>
{% if order.note %}
<h2>Note</h2>
<p>{{ order.note }}</p>
{% endif %}
<p style="margin-bottom: 0;">If you have any questions, please send an email to <u>{{ shop.email }}</u></p>
Copied your template and changed the word Tip to Forum and checked it against one of my orders and works perfectly, so totally stumped as to why it's not working for you:-
The second item had Forum in the title so it removed the quantitity and showed the thanks message instead of it's title.
aaaah, how strange! thanks for looking into this for me.
the code works fine on the Legacy order printer app, so odd that it doesn't work on the new one.
It's the new one it's working on for me which is why I'm stumped that it's not working for you. We don't use tips though so had to change the word. Which amkes me wonder if it is the word Tip itself that's causing the issue but can't find any variables or commands that could be causing problems.
Thank you for posting that.
After looking into this I am now certain that there is no issue with your code and that the problem is 100% caused by the new order printer app.
It seems to me that the new app is incapable of seeing tip line items. I made a test order with one physical item and a tip. When viewing the .json version of the order page both the physical item and the tip are listed as individual line items. However, when looping through line items in the order printer app, it will only ever complete 1 loop - Implying that it does not see the tip line item at all. This is why all the replies are saying it works for them when they change the line item title to search for - Because the order printer can actually see those items.
I've searched through a good amount of documentation and can not see any other way to access the tip information via the new order printer app. When viewing the .json version of my test order I can see there is a property called "total_tip_received" which does indicate the tip amount - But I do not believe it is possible to access this property via the order printer:
Sadly I do not think you will find a solution on these forums. I recommend sending a support email (https://help.shopify.com/en/support/support-type). I do not recommend the live chat as I and many others have had issues with poor support through that method.
I also encourage you or anyone else reading this that is frustrated with this new app to leave an honest review on the new order printer app's store page. In 3 months they will sunset the legacy app and I worry that they will not fix issues such as this unless they are encouraged by an influx of negative reviews and support tickets.
Seems you cannot email support unless you are on the plus plan. Having same issue, will need to go through their chat support which has been so poor the past few years.
What a really lovely load of liquid!
Thank you for sharing.
HOWEVER! If anyone can help... I have an issue which is that the new app is including a blank sheet before each print. Every time and even with their own unedited template.
Any clue as to how to get rid of it?
Thank youuuuu...
This is an accepted solution.
So apparently miracles can happen - I got the answer I needed from Shopify support! 🥳
They wrote this, have added it to the totals summary at bottom of invoice
{% if order.total_tip > 0 %}
<tr>
<td colspan="3" style="text-align: right;">Charity Donation</td>
<td style="text-align: right;">{{ order.total_tip | money }}</td>
</tr>
<tr>
<td colspan="4" style="text-align: right;"><b>❤ Thanks for your donation to akt! ❤</b></td>
</tr>
{% endif %}
works perfectly 👍
Thanks Randy @ Shopify!
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024