Skip to content

Instantly share code, notes, and snippets.

@Bobz-zg
Last active February 16, 2021 05:18
Show Gist options
  • Save Bobz-zg/cc01cd4a037ccdcd34cca1d94f0e8940 to your computer and use it in GitHub Desktop.
Save Bobz-zg/cc01cd4a037ccdcd34cca1d94f0e8940 to your computer and use it in GitHub Desktop.
Include email address in WooCommerce address output | Part 2
<?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