Can anyone provide guidance how to create tokens for custom participant fields, to be added into a Contribution Invoice Receipt for event registrations? Our tax system requires that VAT registration numbers are included in all invoices, and we want to also add purchase order numbers.

(Drupal, Civi 4.7)

Many thanks Davy

  • I don't really understand why you need a token to get the VAT number in there. Why don't you just edit the template used for your Receipt / Invoice and put the VAT number directly in the HTML – petednz - fuzion Apr 24 '17 at 11:06
  • Hi Pete. I had already edited the template to add the event organiser's VAT number etc., but also need to add the VAT and purchase order number of the person registering to attend (or more accurately their company's VAT number). I have found a workaround by creating custom contact (rather than participant) fields - the custom field tokens for contacts {contact.custom_XXX} work perfectly in the Invoice pdf. (although this is not ideal as the PO number will change every time the person makes a new registration.) – Davy Ivins Apr 24 '17 at 12:49

I'm not sure if this is possible - until very recently (version 4.7.17), there wasn't support for custom contribution tokens on a receipt, let alone participant custom tokens. See CRM-8526 for details.

  • Thanks Jon. I'll keep an eye on the progress. I found a workaround in the meantime. – Davy Ivins Apr 24 '17 at 12:50

I found a workaround by creating custom contact (rather than participant) fields, as it is possible to add tokens for custom contact fields to the Contribution Invoice Receipt template.

Here is the process for other non-developers like me:

  1. Create the necessary custom fields (select Contacts in the Used For field)
  2. Create a profile that includes the new custom fields
  3. Add the profile to the Fees section of the Event configuration. Now when delegates register they can complete the new fields.
  4. Add a token for the custom field to the Contribution Invoice Receipt template (the format for the custom fields is {contact.custom_12} where 12 is the ID of the custom data field. To find the ID, go Administer > Customize Data & Screens > Custom Fields and click ‘edit’ on the field you want to use. Look at the URL. The last part of the URL will be an equal sign and a number (=12). The number (12 in this example) is the id of that custom field.) (Thanks Joe Murray for that bit of help)

Caveat: The workaround is not ideal as the PO number is likely to change every time the person makes a new registration so the history will not be retained.


UPDATE - instead of the workaround have a look at the answer to this more recent question How to create tokens for custom fields (participant, individual, organisation)

  • Thanks for going back over lots of similar Questions and adding this answer. – petednz - fuzion Apr 20 '19 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.