edd_add_email_tag()

The  edd_add_email_tag() function allows you to register custom email tags for purchase receipts and admin sale notifications.

The  edd_add_email_tag() function takes three parameters:

  • $tag – The tag to register, such as “admin_email”. In the email settings, tags are wrapped with {} but not when they are registered.
  • $description – A description of what the tag displays.
  • $func – The call back function to render the tag’s output.

Here’s an example that shows how to add a tag that displays the site’s admin email.

function pw_edd_add_sample_email_tag( $payment_id ) {
	 edd_add_email_tag( 'admin_email', 'This tag can be used to output the admin email for the store', 'pw_get_admin_email' );
}
add_action( 'edd_add_email_tags', 'pw_edd_add_sample_email_tag' );
function pw_get_admin_email() {
	return get_bloginfo( 'admin_email' );
}

With the example above active, you could use  {admin_email} in your purchase receipt and sale notifications to display the admin email address.

The  $payment ID is passed to the callback function as a parameter, allowing you to look up any related data that is needed.