Created
March 24, 2015 21:18
-
-
Save SeanChDavis/9a5b5df9e45eeb44ba5b to your computer and use it in GitHub Desktop.
EDD {buyers_address} email tag (replace {billing_address})
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not copy this line | |
/** | |
* Add a {buyers_address} tag for use in either the purchase receipt email or admin notification emails | |
*/ | |
edd_add_email_tag( 'buyers_address', __( 'The buyer\'s billing address (modified)', 'edd' ), 'sd_edd_email_tag_buyers_address' ); | |
/** | |
* The {buyers_address} email tag that place everything on its own line | |
*/ | |
function sd_edd_email_tag_buyers_address( $payment_id ) { | |
$user_info = edd_get_payment_meta_user_info( $payment_id ); | |
$user_address = ! empty( $user_info['address'] ) ? $user_info['address'] : array( 'line1' => '', 'line2' => '', 'city' => '', 'country' => '', 'state' => '', 'zip' => '' ); | |
$return = '<span class="ad1">' . $user_address['line1'] . "</span>\n"; | |
$return .= '<span class="ad2">' . $user_address['line2'] . "</span>\n"; | |
$return .= '<span class="ad3">' . $user_address['city'] . "</span>\n"; | |
$return .= '<span class="ad4">' . $user_address['zip'] . "</span>\n"; | |
$return .= '<span class="ad5">' . $user_address['state'] . "</span>\n"; | |
$return .= '<span class="ad6">' . $user_address['country'] . "</span>"; | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment