Custom invoice theme

The filter is is case sensitive. “Balance due”, not “Balance Due”.

But honestly, is it not easier to switch language when needed rather than use custom themes?

but I have to switch the language of the whole software…

anyway, I was very carefully about case sensitive, it does not depend by it.

Maybe I misunderstood what you wrote. Are you saying that in the totals section of the theme your custom theme works except for the very final line (Ammontare Dovuto in Italian, Balance due in English)? Or are you saying that none of the total.label replacements work?

exactly, work all except the final line.

if I set:

{{ total.label | replace: “Totale”,“TOTAL” | replace: “Importo Pagato”,“Amount Paid” }}

I have this result:
it-parziale

But if I set:

{{ total.label | replace: “Totale”,“TOTAL” | replace: “Importo Pagato”,“Amount Paid” | replace: “Ammontare Dovuto”,“Balance Due” }}

I have this:

This isn’t a coding forum but your syntax looks correct.
But that isn’t necessarily what you have in your theme so it is not possible to say any more

so there is no way to change that name?

No, what @Joe91 said is that your question cannot be answered without seeing the entire theme. That is one reason this is not the place to get your code debugged. Users are responsible for their own custom themes.

the custom theme I’m editing is the smooth blue and I’m adding only the “replace”.
no other changes.

You need to post a copy of the theme.

I think you have not modified correctly

@sket, against my better judgment, I will tell you that your approach will never work. The total.label array has more elements than are displayed on your simplistic example invoice. But they are not constant. Once your replace filtering skips an expected element, the rest of your filtering is ignored. Some of the elements are suppressed when they are zero. The tax total happens to be one of them. So your lack of a tax code had no effect. But if tax totals were not ignored when zero, your replacement with “Amount Paid” would not have worked.

However, later totals in the array are not ignored, even though they are zero in your example. So by the time the theme came to “Ammontare Dovuto,” it was ignoring your code. But it generated the error concerning number of parameters.

What this means is that your theme would partially work in some circumstances, but not work at all in others. Since some of the invisible labels are not fixed, but are variable themselves, it is not possible to write a theme that accounts for them all. An example of why this is so comes from the possibilities of multiple late payment fees, multiple receipts against the invoice, and so forth.

I go back to my original suggestion: switch languages to generate a sales invoice in English; then switch back to Italian. That involves a total of only three clicks.

I think I will do.
thx