• Resolved paulbrian

    (@paulbrian)


    HI

    I have setup the app and site as per the instructions. When the user checks out at the woocommerce page (where we just have first name, last name, email (woo billing fields). It logs them in with facebook, but it keeps me on the same page with the 2 name fields missing. I then need to fill in the names and place the order. Please can you advise. What we need it to do is fill in first and last name and email then log in the user. Thanks! Otherwise looks like a great plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Claude

    (@claudeschlesser)

    Hello,

    WooCommerce probably saves the first and lastname in custom fields that Social Login is not aware of.

    What you could try is a hook like this:
    https://docs.oneall.com/plugins/guide/social-login-wordpress/#3b

    The example is for BuddyPress, but for WooCommerce it should be similar.

    xprofile_set_field_data ('First Name', $user_data->ID, $identity->name->givenName);
    xprofile_set_field_data ('Last Name', $user_data->ID, $identity->name->familyName);

    In these values you have the data:

    $identity->name->givenName
    $identity->name->familyName

    You then need to replace xprofile_set_field_data by the function that saves the data for WooCommerce.

    Do not hesitate to write another post if you are stuck, I will then have a closer look.

    Regards,

    • This reply was modified 4 years, 3 months ago by Claude.
    • This reply was modified 4 years, 3 months ago by Claude.

    Did you ever find a WooCommerce solution for this. Is there a hook to use to populate those pages when you login with this SSO service?

    Thread Starter paulbrian

    (@paulbrian)

    Try putting this in your functions.php:

    //This action is called whenever Social Login adds a new user
    add_action (‘oa_social_login_action_after_user_insert’, ‘oa_social_login_store_extended_data’, 10, 2);
    function oa_social_login_store_extended_data ($user_data, $identity)
    {
    error_log (print_r ($identity, true)); // to get all fields.
    //Example to store the billing first name:
    update_user_meta ($user_data->id, ‘billing_first_name’, $identity->name->givenName);
    update_user_meta ($user_data->id, ‘billing_last_name’, $identity->name->familyName);
    }

    //Set custom roles for new users
    function oa_social_login_set_new_user_role ($user_role)
    {
    //This is an example for a custom setting with one role
    $user_role = ‘customer’;

    //The new user will be created with this role
    return $user_role;
    }

    //This filter is applied to the roles of new users
    add_filter(‘oa_social_login_filter_new_user_role’, ‘oa_social_login_set_new_user_role’);

    Awesome. Thanks so much for sharing!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce Checkout Reg with Facebook – Names missing’ is closed to new replies.