First/Last name not set in the checkout form

Home Forums Jevelin Theme First/Last name not set in the checkout form

Home Forums Jevelin Theme First/Last name not set in the checkout form

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    RESOLVED Posts
  • CBDFactum
    Participant

    Email for testing: [email protected]

    Password: in the private field

    Site: https://cbdfactum.com

     

    When you put a product into the shopping cart and try to check out and log in, then the first & last name fields are not set.

     

    I tested it without any additional plugins. It doesn’t appear, so the plugins shouldn’t be the reason.

     

    Did I misunderstand something that it is not set or should it be set with the first & last name from the account?

    Hi @CBDFactum,

     

    I hope you are well today and thank you for your question.

     

    This is WooCommerce plugin related question so please contact the plugin support to resolve it.

     

    Best regards,
    Shufflehound team

    CBDFactum
    Participant

    Solution for this topic

    I confirm it has nothing to do with your theme. I present here the solution so it is available for others. The code has to be placed in functions.php:

    function populate_specific_checkout_field($input, $key ) {
     global $current_user;
     switch( $key ) {
      case 'billing_first_name':
      case 'shipping_first_name':
       // return the first name
       return $current_user->first_name;
    
      case 'billing_last_name':
      case 'shipping_last_name':
       // return the last name
       return $current_user->last_name;
     }
    }
    add_filter('woocommerce_checkout_get_value', 'populate_specific_checkout_field', 15, 2 );
    • This reply was modified 4 years, 4 months ago by CBDFactum.

    Awesome great to see you got that resolved.

     

    Please advise if you have more questions.

     

    Have a fantastic day!

Viewing 4 posts - 1 through 4 (of 4 total)