What are the Liquid variables to access the tips for an order?

Solved
Tourist
4 1 2

The new tipping feature to let customers leave a tip in the checkout of our online shop (https://help.shopify.com/en/manual/checkout-settings/tips) is great!

Trinkgeld.png

 

However, I cannot find how to access this tipping information afterwards. I looked in the Liquid reference: https://shopify.dev/docs/themes/liquid/reference/objects/ but came up empty handed. I would like to reference it in our invoices that we create using the Order Printer app (https://apps.shopify.com/order-printer). 

 

Who can help here? 

 

 

Tourist
4 1 2

This is an accepted solution.

Update: I found out that the tip is handled as a line item in the order. 

So I am currently filtering for it like this:

{% for line_item in line_items %}
     {% if line_item.title == "Tip" %}
          do something with the tip
     {% endif %}
{% endfor %}

This is quite counterintuitive, since I would expect the tip to be handled as an order attribute or perhaps transaction.

Hope it helps for others!

New Member
2 0 0

This doesn't work for me.

No tip included in the line_items list.

Does it still work for you right now?

 

0 Likes
Tourist
4 1 2

Yes, it still works for me. 

I activated tipping via the Settings menu, Checkout options. And built the invoice template in the Order Printer app.

 

  {% for line_item in line_items %}
   {% if line_item.title == "Tip" %}
    <tr>
      <td>Tip:</td>
      <td>{{ line_item.price | money }}</td>
    </tr>
   {% endif %}
  {% endfor %}

 

 

0 Likes
New Member
2 0 0

Yes, I activated the tipping in the Checkout Settings.

I'm accessing line_items from the order status page via the custom script.

I am able to get product items but the tip is not included.

 

0 Likes