TWIG: Missing essential variables (client number …)

Hey guys,

did nobody recognize that there are several essential twig-variables missing? There seem to be no variables for

– a client’s number (within invoices etc.)
– client’s invoice-street, -city, -postal-code or for delivery
etc.

One can use the old fashioned variables within invoices which use twig-code, too, but within templates these variables do not work – and as David said, they shouldn’t be used anyway.

I mentioned before that using twig-templates is nearly impossible for invoices when task-details are set to be printed as service-details (twig does not interprete html-/css-code while the task-details are saved as css-formated strings). And finding the right code for picking all the needed task-details for creating twig-based invoices is kind of a mystic thing for even advanced newbies.

Does anyone maybe has some practice with twig-templates and would be so kind to help out when needed? That would be awesome!

Greets

Schmitti

It is all compromises. If we were to include the full client object within the invoice, the payload would be massive and it would slow down the generation of the template significantly.
We do provide the most import variables (we think) for each invoice

'name'
'balance'
'payment_balance'
'credit_balance'
'vat_number'
'currency'
'custom_value1'
'custom_value2'
'custom_value3'
'custom_value4'
'address'
'shipping_address'
'locale'

But also - as you have mentioned - if you are creating a dedicated template for a single invoice, you will always have access to every variable via the $ notation.

ie. $client.number etc etc

1 Like