Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Updating usermeta from login redirect to billing address

Sorry, I wasn’t able to retrieve the $_GET variables.
The solution was to retrieve the values from the database, and insert them into the proper places in the template file (form-edit-address.php)
This works 🙂

<?php 
    $user_id = get_current_user_id();
    $user_info = get_userdata( $user_id );
    $first_name = $user_info->first_name;
    $last_name = $user_info->last_name;
?>
<?php do_action("woocommerce_before_edit_address_form_{$load_address}" ); ?>

<?php 
      foreach ( $address as $key => $field ) : 
            if ($key == 'billing_first_name' && $field['value'] == '') 
                 woocommerce_form_field( $key, $field, $first_name );
            elseif ($key == 'billing_last_name' && $field['value'] == '')
                 woocommerce_form_field( $key, $field, $last_name ); 
            else 
                 woocommerce_form_field( $key, $field, ! empty( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : $field['value'] );
        endforeach;

...

Related Posts:

  1. Woocommerce registration page [closed]
  2. Separate registration and login for different roles
  3. SSO / authentication integration with external ‘directory service’
  4. How to prefill WordPress registration with social details
  5. WordPress registration message
  6. How to remove the WordPress logo from login and register page?
  7. Login email after registration never sent or received
  8. I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
  9. How do I check if a post is private?
  10. Receiving “This content cannot be displayed in a frame” error on login page
  11. How to customise wp-login.php only for users who are setting a password for the first time?
  12. What hooks should I use for pre-login and pre-registration actions?
  13. Change register form action url
  14. Problem with logging in WP users automatically
  15. How can I allow access to two user accounts using one login?
  16. Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
  17. Register/Login using only phone number?
  18. Force users to register in order to view website [duplicate]
  19. How do I force “users must be registered and logged in” on subsites?
  20. auto login after registeration for wp-members plugin
  21. How To Change Wp Register/Login URL Permanently To My Custom Page
  22. How to modify the action attribute of the wp-login.php?action=register form?
  23. Correct passwords keep appearing as incorrect
  24. Disabling standard registration login with username/email and password?
  25. Login form doesn’t log in
  26. Get the url of custom login page in the registration page
  27. By registering always make uppercase the first letter of the login
  28. Show reCaptcha on Custom Frontend Login & Register Form [closed]
  29. Best option to implement external register/login to WP from self-made API
  30. Auto Login After Registration
  31. Disable all other page except index,register,login till user login
  32. What speaks against using a custom login.php / register.php to wordpress?
  33. How do I add Login fields and registration link to the header?
  34. How to make a user be able to register if such a login already exists?
  35. Sending new registration meta values to admin by email
  36. Are login functions considered part of the WP backend?
  37. WordPress registration page template
  38. Removing “public” user registration without completely turning it off?
  39. Disable registration on certain condition
  40. what is the best and safest way to allow users to register to site
  41. Updated : how to make email optional while user registration using default wordpress form
  42. Problem in auto login after registration
  43. How to invalidate `password reset key` after being used
  44. How do i Redirect specific user(WooCommerce Sign-in not wordpress admin page sign-in) to specific page
  45. Chosen user password in registration is not being accepted on Login
  46. WordPress auto login user after registration only from a specific page
  47. User account activation links are lacking query strings
  48. Login user after registration programmatically
  49. How to get rid of the username of registration form in theme my login wp plugin?
  50. Where do I find “log in” and “register” link which are located on the top right corner?
  51. How to force login after user browses for a few minutes or browses a few pages?
  52. Registration and Login form
  53. WordPress and Magento: let WordPress manage user registration and logins?
  54. redirect not logged in users to specific page and redirect them back where they come from
  55. how to add custom word press regisration form in word press 3.5 with out module [closed]
  56. Click on banner to register to the blog
  57. How to put Login, Register and newsletter widget on the same page?
  58. make a login system for site visitors
  59. How to create a fully functional user registration in WordPress?
  60. Remove login fields from /customer-account page [closed]
  61. How can I customize the content of the login page?
  62. WordPress giving error when I log in after trying emergency.php
  63. WordPress keeps redirecting to an unsecure connection?
  64. A way to redirect users when they log in based on their current page
  65. Some crawlers/bots attempting to login with very good guesses. How?
  66. Cannot login in WordPress even after changing hash password in phpmyadmin
  67. Custom Field For Login
  68. User login without username, only password
  69. Creating login for client / customer that will take them to customized part of site
  70. Opening protected page with cookie?
  71. wp-login.php just refreshes the form fields
  72. WordPress login issue . Permission Problem
  73. Login just resets/reset password link also does not work
  74. How can I have customers log in using ONLY customer number? No password
  75. Users redirected to old site
  76. Problem with footer and login
  77. Create custom field for users to check if they agreed to terms
  78. WordPress logs out on protocol switch
  79. Improvements to “limit login attempts” plugin
  80. Add a required field to Registration
  81. wp_lostpassword_url not escaped
  82. WP login pages redirect to homepage (cannot login)
  83. Change “login/register” to “useraccount” when a user has logged in
  84. Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
  85. Remember me doesn’t work with www?
  86. How to place wp-login.php in page or page template?
  87. Webpage not found upon entering wrong username and password on custom login form?
  88. WordPress Login / SSL = Code Question
  89. loging to Admin page not working at all
  90. Can’t login through wp-login.php on fresh installation
  91. Is there any reason why there’s no “login_header” action at the login page?
  92. Simplest way to create two private sections each with a common account
  93. changing WordPress login page
  94. Shared user database trick not working
  95. WordPress Cookies – wp_set_auth_cookie
  96. Authenticate return value
  97. Hide wp-login.php but not the widget
  98. Register and Connect links: where are they located?
  99. Save user login date
  100. Login with Username (or Code) only
Categories login Tags login, user-registration, woocommerce-offtopic
How do I change tab url
How can I write this code snippet so that it echo’s the response when submitting empty fields?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress