Forked from andrewlimaza/add-shipping-address-to-admin-order.php
Created
February 5, 2019 11:15
-
-
Save travislima/6b00b8bb363860e928e2b06d0c1d9c93 to your computer and use it in GitHub Desktop.
Add Shipping Address Details To Admin Order View
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 | |
/** | |
* 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
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/