• Hi,
    In the site we are creating, people are encouraged to sign up to the site right away.

    After signed up, then if they put an item in the cart and go to checkout, the name and address fields are empty and they have to sign up and make another account (I assume just for woocommerce) in order to purchase.

    Why would there have to be two accounts created? If this is required, isn’t there a way to at least transfer the original signup data to the checkout sign up form? This makes a bad “user experience”.

    Thanks!

    https://www.ads-software.com/plugins/woocommerce/

Viewing 15 replies - 1 through 15 (of 21 total)
  • Found this snippet in a raw Google-search and threw it into my (child) function.php plugin which solved the problem. Might be a hazardous hack, but don’t know any better being a newbie to all this. But this code does what was needed, to at least populated the checkout fields of someone already logged in.
    —–

    // Auto Update Woocommerce billing and shipping name,email on profile update
    add_filter( 'profile_update' , 'custom_update_checkout_fields', 10, 2 );
    function custom_update_checkout_fields($user_id, $old_user_data ) {
     $current_user = wp_get_current_user();
     // Updating Billing info
     if($current_user->user_firstname != $current_user->billing_first_name)
     update_user_meta($user_id, 'billing_first_name', $current_user->user_firstname);
     if($current_user->user_lastname != $current_user->billing_last_name)
     update_user_meta($user_id, 'billing_last_name', $current_user->user_lastname);
     if($current_user->user_email != $current_user->billing_email)
     update_user_meta($user_id, 'billing_email', $current_user->user_email);
     // Updating Shipping info
     if($current_user->user_firstname != $current_user->shipping_first_name)
     update_user_meta($user_id, 'shipping_first_name', $current_user->user_firstname);
     if($current_user->user_lastname != $current_user->shipping_last_name)
     update_user_meta($user_id, 'shipping_last_name', $current_user->user_lastname);
     if($current_user->user_email != $current_user->shipping_email)
     update_user_meta($user_id, 'shipping_email', $current_user->user_email);
    }

    —–

    Thread Starter scottl31

    (@scottl31)

    Darn, this did not work for me. Did you do anything besides just put it in the theme functions.php?

    Could it be because I’m in WC 2.2?

    Made a special child plugin version of the theme function.php which is where snippets of experimental code resides.

    Do not remember the link to the instructions to creating the (child) function.php, though it is supposed to act the same as what you are doing, (inserting code into the theme function.php), except a little bit easier to manage. Meaning it can be turned on/off via the plugin settings if fatal errors result.

    (Will see if I can find the instruction anyway for reference.)

    As for the above code not working, it should unless something is interfering. Make sure you are testing with a live site; had issues with construction/maintenance mode active, the login/logout would reset.

    Do not think the version of WC would make a difference, but then don’t know what all the changes are; documentation is slim.

    Thread Starter scottl31

    (@scottl31)

    When you say “child plugin version of the theme function.php”, do you mean to just use a child theme of my main theme and put this in it’s own function.php file?

    If so, I don’t have the child theme made yet since this is my first real edit, but I should be able to put it in the main theme’s function.php file to see if it works, right?

    If not, are you doing something different than just being safe and not editing your main theme’s function.php file?

    *gack* Please don’t take my vernacular literally. Just started this project, learning WP and coding, four months ago. I’m a clueless newb! So do not understand the lingo well enough to answer definitively.

    Going to find my notes on what I did to start out, but all the beginner guides said to make a child theme, so I did. And one had great instructions to create the extra child function.php file. But only the one. Got the links somewhere, took lots of notes to dig thorough, but will get back to you soon.

    * * * *

    Thread Starter scottl31

    (@scottl31)

    Ha! Sorry, I know what you mean. I’ve been at it for a while but still can’t get a lot of it right.

    Been too lazy to do child themes, but I’m going to start.

    Thanks for any extra help!

    Here is the link:

    Creating a Site-Specific Snippets Plugin
    https://ottopress.com/2011/creating-a-site-specific-snippets-plugin/

    Make this above file, and make a child theme as well. Will save you headaches in the long term.

    * * * *

    Here is a more current link of the same thing, but a bit more polished:

    https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/

    * * *

    Thread Starter scottl31

    (@scottl31)

    Wow, never heard of Site-Specific Snippets Plugin. This is cool.

    Did you do this and then put that address code in it?

    Seems it is independent of the theme if it is a plugin.

    Do you know if you can put css changes in there too?

    It is cool!

    Yes, did make this, put the address code snippet in and have it work error free (after turning off maintenance mode). It is independent of the theme; makes it an easy, safe experimental file.

    No, CSS shouldn’t go in it at all. Custom CSS should go into a child style.css or if your theme provides one, their custom styles.css file.

    Good luck. ??

    * * * *

    Thread Starter scottl31

    (@scottl31)

    Now this is funny. I found that I was actually already using a plugin like this called “My Custom Code” and putting custom WC stuff in there.

    I’m pretty bummed that your code did not work, even with the snippet plugin. My boss is going crazy with the fact that users have to sign up again for the site when they get to the checkout page.

    Do you have any other suggestions?

    Thanks!

    I spent half a day searching for a solution to the above problem.

    From what I gathered from various articles, Woo removed the connection/sync between WP-accounts and Woo-accounts. The thinking was/is, if I understand correctly, a WP-account is like an admin, blogger or a reader/commentator, whereas Woo-accounts are buyers and therefore require a separate partitioned setup.

    So to solve the syncing of visitor info to an “account” is to use a “membership” type plugin.

    (Make it so they can be defined within “groups” which maybe can be managed and tracked for sales data. ? – I’m thinking aloud, the above is my assessment of the possible reasons for the un-syncing)

    Then my research discovered membership type plugins are massively complicated and usually cost a lot.

    I only needed the snippet of code. Otherwise it’s back to searching for a plugin to define and manage Woo accounts.

    Wish I could help, I’m in your shoes, wanting to make an ecommerce site not suck, instead be professional and very convenience for customers. They are very fickle and won’t stay to figure out why things don’t work; business is lost on simple details.

    * * * *

    Note, if you end up having to look for membership plugins to solve the problem, make sure they specifically say they link with Woocommerce accounts. Not all do, and that is crucial for the task at hand.

    * * * *

    Another note: Looking over some of the bookmarks from my search, this membership plugin looked the most promising and didn’t cost too much. ($28) And auto-syncs with Woo.

    User Profiles Made Easy
    https://codecanyon.net/item/user-profiles-made-easy-wordpress-plugin/4109874

    * * * *

    Thread Starter scottl31

    (@scottl31)

    One more question about your code if you don’t mind.

    Is it supposed to populate the fields on the checkout page when the page loads for any user who already exists, or do I need to create a new user the way we have been for it to read the contents of the fields being filled so it can copy them over automatically?

    Wonder if it could be a 4.0 thing. Are you using 4.0?

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Customer Name/Address info blank’ is closed to new replies.