• Resolved othmaneerraih

    (@othmaneerraih)


    This is my website : test.korbi.ma

    Hello guys,

    I am using woocommerce with Bacola theme. I am using this plugin “https://www.ads-software.com/plugins/mobile-login-woocommerce/” for OTP verification.

    My problem Is that when a new user registers, his First Name, Last Name and Phone number not saved with the account, instead only his email is found.

    I used the following code to try and force them to save but with no luck :

    // Hook to save additional user meta data when registering
    function save_custom_user_meta($user_id) {
        if (isset($_POST['first_name'])) {
            update_user_meta($user_id, 'first_name', sanitize_text_field($_POST['first_name']));
        }
        if (isset($_POST['last_name'])) {
            update_user_meta($user_id, 'last_name', sanitize_text_field($_POST['last_name']));
        }
        if (isset($_POST['phone_number'])) {
            update_user_meta($user_id, 'xoo-ml-reg-phone', sanitize_text_field($_POST['xoo-ml-reg-phone']));
        }
    }
    add_action('woocommerce_created_customer', 'save_custom_user_meta');
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘First Name, Last Name, Phone number not saving with the user account’ is closed to new replies.