Created
December 5, 2018 11:21
-
-
Save andrewlimaza/d1b1129e952f0734255cc14c6d492ac2 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