Skip to content

Instantly share code, notes, and snippets.

@amdrew
Last active December 27, 2015 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/7259097 to your computer and use it in GitHub Desktop.
Save amdrew/7259097 to your computer and use it in GitHub Desktop.
Add payment meta information to the admin sales notification in Easy Digital Downloads
<?php
function my_child_theme_edd_sale_notification( $email_body, $payment_id, $payment_data ) {
// retrieve payment meta array and unserialize it
$payment_meta = maybe_unserialize( get_post_meta( $payment_id, '_edd_payment_meta', true ) );
// add your fields here
$company = $payment_meta['company'];
$phone = $payment_meta['phone'];
// append information to email body
$email_body .= '<br /><br />' . '<strong>Additional Information</strong>' . '<br />';
$email_body .= 'Company: ' . $company . '<br />';
$email_body .= 'Phone: ' . $phone;
return $email_body;
}
add_filter( 'edd_sale_notification', 'my_child_theme_edd_sale_notification', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment