{% set total_g_weight = 0 %}
{% for i in doc.items %}
{% set g_weight = i.qty|float * i.custom_gross_weight|float %}
<!-- Add g_weight to the total -->
{% set total_g_weight = total_g_weight + g_weight %}
<!-- Display g_weight for the current item -->
<td style='text-align:right;'><b>{{ "%.4f €"|format(g_weight) }}</b></td>
{% endfor %}
Total Gross Weight : {{ "%.4f €"|format(total_g_weight) }}