How to Display Custom Fields in Sales Invoice Theme

Hello everyone,

I’m currently editing my Sales Invoice theme in Manager.

The default fields work perfectly — for example, {{ business.name }} displays my business name,

and {{ recipient.name }} displays the customer name.

However,

I’m having trouble displaying custom fields. When I try something like:

{{ business.custom_fields["Phone Number"].text }}

or

{{ recipient.custom_fields["Customer Phone"].text }}

nothing appears on the invoice.

Could someone guide me on the correct way to reference and display custom fields from both the business and customer sections in a Sales Invoice theme?

Thank you in advance for your support!

Hello @Hazem,

This method of direct access to custom fields arrays have been deprecated for a lomg while.

You can instead use the following:

{% for field in custom_fields%}
   {% if field.label == "Phone Number" %}
      {{ field.text }}
   {% endif %}
{% endfor %}

But that’s not a permanent solution since Themes are moving aways from Liquid towards full javascript.

1 Like