Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 5, 2018 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewlimaza/d1b1129e952f0734255cc14c6d492ac2 to your computer and use it in GitHub Desktop.
Save andrewlimaza/d1b1129e952f0734255cc14c6d492ac2 to your computer and use it in GitHub Desktop.
Add Shipping Address Details To Admin Order View
<?php
/**
* This will add Shipping Address information when an admin view's the user's order in the WordPress dashboard.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_add_shipping_address_to_admin_order_view( $order ) {
$user_id = $order->user_id;
$firstname = get_user_meta($user_id, "pmpro_sfirstname", true);
$lastname = get_user_meta($user_id, "pmpro_slastname", true);
$address1 = get_user_meta($user_id, "pmpro_saddress1", true);
$address2 = get_user_meta($user_id, "pmpro_saddress2", true);
$city = get_user_meta($user_id, "pmpro_scity", true);
$state = get_user_meta($user_id, "pmpro_sstate", true );
$zip = get_user_meta($user_id, "pmpro_szipcode", true );
$country = get_user_meta($user_id, "pmpro_scountry", true );
?>
<tr>
<th><strong>Shipping Address:</strong></th>
<td><?php echo $firstname . ' ' . $lastname . ', ' . $address1 . ', ' . $address2 . ', ' . $city . ', ' . $state . ', ' . $zip . ', ' . $country; ?></td>
</tr>
<?php
}
add_action( 'pmpro_after_order_settings', 'my_pmpro_add_shipping_address_to_admin_order_view' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment