How to rename the sub-total coloumn name

i want to rename the sub-total coloumn name . i tried many tweaks in custom theme but wasn’t successful.
also the amount in words , i wana add “only” at end of the sentence.

I don’t think there is sub-total column name. There is a total called sub-total. What have you tried?

For example, in plain theme, there are these lines:

{% for total in table.totals %}
        <tr>
            <td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
            <td style="border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
        </tr>
{% endfor %}

On these lines, there is {{ total.label }} which you can replace with {{ total.label | replace: "Sub-total", "Your new text" }}

This will rename Sub-total to Your new text.

1 Like

thanks @ lubos . it worked.

but how to add “only” at total amount written in words,?

Not sure if that should be solved by theme. Perhaps Only suffix should show to everyone, right?

I would disagree. There have been requests over time from many users for the ability to add an amount in words. But they have been from different countries and in different situations. This is the first explicit request for the suffix Only that I can recall. So it hardly seems like a universal need, even for those who want amounts in words.

well “only” is used so that no one can write anything after the amount in words so that the total amount value dont get changed… if someone write a number in words after total amount in words then there is chances of forging in printed invoice. and only will help stop this kind of chances

yes. can u share to display it how?

Well… Total in words is injected as custom field so you can inject Only text if custom field is named Total in words.

For example, in plain theme, you have these lines:

{% for field in custom_fields %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
            </td>
        </tr>
{% endfor %}

You can insert {% if field.label == 'Total in words' %} Only{% endif %}

So it becomes:

{% for field in custom_fields %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}{% if field.label == 'Total in words' %} Only{% endif %}</div>
            </td>
        </tr>
{% endfor %}
1 Like

its working perfectly @lubos