Customer Custom Field on invoice

I want to show a custom field ‘Vat number’ on my invoice but am struggling to get it right

{{ recipient.name }}
{{ recipient.address | newline_to_br }}
{% if {{ customer.custom_fields['Vat number'] }} != null %}
"Customer Vat #:" {{ customer.custom_fields['Vat number'] }}
{% endif %}

But it shows
Liquid error: Value cannot be null. (Parameter ‘input’)

Try without customer.

If you tick show on documents in the custom field edit screen it will print on the sales invoice

Not sure why you need this, surely the customer will know his Vat number?

1 Like

Why not just put the VAT number into the Business Identifier field when defining the customer? That is what that field is for.

1 Like

As far as I understand its a legal requirement for VAT purposes to have it on the invoice for vat registered entities

I probably should not ask this but now I get

Liquid error: Value cannot be null. (Parameter ‘input’)

but I am checking for null

I’m not in front of Manager. Can you try to replace {{ customer.custom_fields[‘Vat number’] }} with {{ recipient.custom_fields[‘Vat number’] }} ?

Thanks. But

if I do this as a test

{{ recipient.name }}
{{ recipient.address | newline_to_br }}
{% if {{ custom_fields['VAT Number'] }} != null %}
{{ recipient.address | newline_to_br }}
{% endif %}
Customer Vat #: {{ custom_fields['VAT Number'] }}

The

Customer Vat #: 1234556
displays but the if condition fails with Liquid error: Value cannot be null. (Parameter ‘input’)
So the number is available but the if is not happy

You typed:

But @Davide advised

ie add the word recipient

This works

{{ recipient.name }}
{{ recipient.address | newline_to_br }}
{% if custom_fields['VAT Number'] != null %}
Customer Vat #: {{ custom_fields['VAT Number'] }}
{% endif %}
                </td>

No idea what caused the issue really but thanks all for the help

Kiss - why not do as Tut suggested


You can <br> to add a blank line(s) if required

Has the advantage that it will appear on other documents related to the customer as well

1 Like