Skip to content

Instantly share code, notes, and snippets.

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 travislima/6b00b8bb363860e928e2b06d0c1d9c93 to your computer and use it in GitHub Desktop.
Save travislima/6b00b8bb363860e928e2b06d0c1d9c93 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' );
@laurenhagan0306
Copy link

This recipe is included in the blog post on "How to display the Member’s Shipping Address in the Orders admin area." at Paid Memberships Pro here: https://www.paidmembershipspro.com/how-to-display-the-members-shipping-address-in-the-orders-admin-area/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment