Total order quantity

How can I add the total quantity of the items ordered to my invoices? I found the code on here but it doesnt seem to work for me. Using the Dawn template

You can use this code to show total ordered item onto your invoice

{% assign total_quantity = 0 %}
{% for line_item in order.line_items %}
  {% assign total_quantity = total_quantity | plus: line_item.quantity %}
{% endfor %}

Total Quantity: {{ total_quantity }}