#StackBounty: #woocommerce #hooks #user-meta #profiles 'profile_update' hook alternative for WooCommerce user meta data

Bounty: 50

I am trying to get all user details (including WooCommerce meta data) in a function that is called with user_register and profile_update hooks. This is the simplified code:

function get_all_user_data($user_id) {

    $user_data = get_userdata($user_id);

    $login = $user_data->user_login;

    $b_firstname = get_user_meta($user_id, 'billing_first_name', true);


The behavior:

  1. User is registered, I can access it’s userdata (e.g. login) immediately
  2. WooCommerce billing address is updated and saved, however I still only can access the $login variable, ‘billing_first_name’ meta is apparently still empty at this time
  3. WooCommerce shipping address is updated and saved, after this I can access the billing information that were saved in previous step, but not the shipping data that was saved in current step

The same goes for a scenario in which the user is registered during WooCommerce checkout, no WC data is accessible at that time yet.

PS: I have also tried the woocommerce_after_save_address_validation hook, but that seems to have the same behavior as the profile_update in my case.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.