Last active
February 16, 2021 05:18
-
-
Save Bobz-zg/cc01cd4a037ccdcd34cca1d94f0e8940 to your computer and use it in GitHub Desktop.
Include email address in WooCommerce address output | Part 2
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 | |
/** | |
* Append email in list of visible info | |
* | |
* @link https://github.com/woocommerce/woocommerce/blob/ab4a46e32e338cbf33094ab26144744a021a21a9/includes/wc-account-functions.php#L316 | |
*/ | |
add_filter( 'woocommerce_my_account_my_address_formatted_address', function( $address, $user_id, $address_type ) { | |
// Meta key is either billing or shipping | |
$meta_key = $address_type . '_email'; | |
$address[ $meta_key ] = get_user_meta( $user_id, $meta_key, true ); | |
// Return | |
return $address; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment