How to display custom donation fields in email or on webpages

Official response from

It has always been possible to display custom people field values in emails (blasts or autoresponse emails) or on webpages, but until now there has not been a way to display custom donation fields. The following liquid attribute is an attribute of the "donation" object, so you could use it in combination with the "last_donation" object or you could use it in a forloop of the "donations" array of a profile. 🙌   🙌   🙌

This can be particularly useful for displaying the response to a custom donation field into the template for a donation page auto-response email so that the donor has a more detailed receipt of their transaction. In many cases, customers use custom donation fields to allow donors to specify what cause the donation is for or who it is in memory of, but until now it was difficult to display this info in the immediate auto-response email.

The following will display the value of the custom donation field with the slug "shirt_size" for the most recent donation in an email:

 T-shirt size: {{ recipient.last_donation.custom_values['shirt_size'] }}

And here is an example of how to use a checkbox custom field in a liquid conditional (i.e. "IF/THEN") statement: 

{% if recipient.last_donation.custom_values['is_registration_fee'] == '1' %}This transaction was a registration fee.{% endif %}

Lastly, the following code could be used on a public profile page to show users a table of their donations with the custom fields included in that table:

{% if profile.id == request.current_signup.id %}

Your Donations:

<table>

<tr>

<th>Date</th>

<th>Amount</th>

<th>Cause</th>

</tr>

{% for donation in profile.donations %}

<tr>

<td>{{ donation.succeeded_at | date_to_string }}</td>

<td>{{ donation.amount_format }}</td>

<td>{% if donation.custom_values[‘cause’] == empty %} N/A {% else %}{{ donation.custom_values[‘cause’] }}{% endif %}</td>

</tr>

{% endfor %}

</table>

{% endif %}

Complete and current information on how to use NationBuilder is available in the documentation section.

Share this post

Showing 10 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.