Im trying to change wp_set_password pluggable function and add custom action to it:
function wp_set_password( $password, $user_id ) {
    // Keep original WP code
    global $wpdb;
    $hash = wp_hash_password( $password );
    $wpdb->update(
        $wpdb->users,
        array(
            'user_pass'           => $hash,
            'user_activation_key' => '',
        ),
        array( 'ID' => $user_id )
    );
    wp_cache_delete( $user_id, 'users' );
    // and now add your own
    $custom_hash = password_hash( $password, PASSWORD_DEFAULT );
    update_user_meta($user_id, 'user_pass2', $custom_hash);
}
I put this code in my custom plugin, but it doesnt run the custom action I wrote inside of it. I'm not sure what the problem is.
Maybe I put it in on the wrong location or I should call it somewhere?
How to hook in wp_set_password() WordPress function with WooCommerce?
Edit
This code doesn't fire at all, I tried to put the same password in users table but it doesn't care about my code and do the default action.
Edit 2
I comment the code in the plugin and changed the main pluggable.php file in the wp-includes folder, and added these 2 lines.
$custom_hash = $password;
update_user_meta($user_id, 'user_pass2', $custom_hash);
But it still doesn't work.
Edit 3
I even removed the whole function from pluggable.php, It still works! I have created a username and password for new users.
It should be WooCommerce registration. I use WooCommerce login system.
Edit 4
I used the WordPress registration system /wp-login.php and this code works finally.
Now I'm wondering regarding WooCommerce where and how I could achieve something like this, updating the wp_usermeta table with something custom.
                        
You could try to use the
WC_Customer()Class available setters methods like:Addition - Create a customer with Woocommerce:
1) You can use
wc_create_new_customer()function that returns the user ID.2) Or You can use an empty instance of the
WC_CustomerObject using on it any setters available methods (and it will return at the end the User ID):