Displaying extra fields in invoice template

Last updated on
8 October 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

By default, Extra Fields Pane field's values are not displayed in the invoice that is sent by Ubercart. To let values of extra fields show up in the customer invoice mail, you need to copy the customer invoice template to your theme and then edit it to add the extra fields variables in there.

This document describes how a field variable is called for Extra Fields Pane versions 7.x-1.x and 6.x-2.x. The 7.x-1.x version uses an other pattern than the 6.x-2.x version.

For more information about custom invoice templates, read How to customize the order invoice customer e-mail.

Extra Fields Pane 7.x-1.x

For the 7.x-1.x version of Extra Fields Pane, each field variable uses the following pattern:

$uc_addresses_(address type)_(field name)
  • '(address type)' can be 'shipping' or 'billing'.
  • '(field name)' is the machine name of your field, for example 'ucxf_gender'.

So, if for example your extra field is called 'gender', then these variables will be available for the Ubercart invoice template:

  • $uc_addresses_shipping_ucxf_gender;
  • $uc_addresses_billing_ucxf_gender;

Steps:

  1. Copy the template 'uc-order--customer.tpl.php' to your theme (the template can be found in ubercart/uc_order/templates).
  2. Edit the template uc-order--customer.tpl.php, add variables of extra fields to it (i.e. $uc_addresses_shipping_ucxf_gender).

Extra Fields Pane 6.x-2.x

For the 6.x-2.x version of Extra Fields Pane, each field variable uses the following pattern:

$extra_(pane_type)_(field name)
  • '(pane_type)' can be 'extra_delivery', 'extra_billing' or 'extra_information'.
  • '(field name)' is the machine name of your field without the 'ucxf_' prefix, for example 'gender'.

So, if you have an address field that's called 'gender', then these variables will be available for the Ubercart invoice template:

  • $extra_extra_delivery_gender;
  • $extra_extra_billing_gender;

And if you have a custom field that's called 'your_reference', then this variable will be available for the Ubercart invoice template:

  • $extra_extra_information_your_reference;

Steps:

  1. Copy templates uc_order-customer.tpl.php and uc_order.tpl.php to your theme (the templates can be found in ubercart/uc_order/templates).
  2. Edit the template uc_order-customer.tpl.php, add variables of extra fields to it (i.e. $extra_extra_delivery_gender).

Help improve this page

Page status: No known problems

You can: