I am using woocommerce API to create a customer API is working fine and the new customer is creating fine into WP. But the issue is when I am using a hook "woocommerce_created_customer" I am not able to get user meta data like "first name", "last name" etc
Here is a part of my code:
```
$this->loader->add_action( 'woocommerce_created_customer', $plugin_admin, 'add_user_to_zendesk', 50 );
public function add_user_to_zendesk( $user_id ) {
if ( isset( $user_id ) && ! empty( $user_id ) ) {
$user = get_user_by( 'id', $user_id )->data;
error_log('USER DATA'. print_r( $user, true ) );
error_log('USER METADATA'. print_r( get_user_meta($user_id), true ) );
}
}
```
Here is a response in log file
```
[01-Sep-2018 08:30:50 UTC] USER DATAstdClass Object
(
[ID] => 99
[user_login] => geek2
[user_pass] => XXXXXXXXX.
[user_nicename] => geek2
[user_email] => geek2@gmail.com
[user_url] =>
[user_registered] => 2018-09-01 08:30:49
[user_activation_key] =>
[user_status] => 0
[display_name] => geek2
)
[01-Sep-2018 08:30:50 UTC] USER METADATAArray
(
[nickname] => Array
(
[0] => geek2
)
[first_name] => Array
(
[0] =>
)
[last_name] => Array
(
[0] =>
)
[description] => Array
(
[0] =>
)
[rich_editing] => Array
(
[0] => true
)
[syntax_highlighting] => Array
(
[0] => true
)
[comment_shortcuts] => Array
(
[0] => false
)
[admin_color] => Array
(
[0] => fresh
)
[use_ssl] => Array
(
[0] => 0
)
[show_admin_bar_front] => Array
(
[0] => true
)
[locale] => Array
(
[0] =>
)
[wp_capabilities] => Array
(
[0] => a:1:{s:8:"customer";b:1;}
)
[wp_user_level] => Array
(
[0] => 0
)
[_yoast_wpseo_profile_updated] => Array
(
[0] => 1535790649
)
)
```
Can someone please help to figure out the issue...