Created
          July 17, 2014 08:51 
        
      - 
      
 - 
        
Save corsonr/c2781c9e0cc086c5047f to your computer and use it in GitHub Desktop.  
    WooCommerce: Add customer username to edit/view order admin page
  
        
  
    
      This file contains hidden or 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 | |
| // Add WooCommerce customer username to edit/view order admin page | |
| add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_order_username', 10, 1 ); | |
| function woo_display_order_username( $order ){ | |
| global $post; | |
| $customer_user = get_post_meta( $post->ID, '_customer_user', true ); | |
| echo '<p><strong style="display: block;">'.__('Customer Username').':</strong> <a href="user-edit.php?user_id=' . $customer_user . '">' . get_user_meta( $customer_user, 'nickname', true ) . '</a></p>'; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment