• We had a code snippet working with Ultimate Member 1.3.88 but the code snippet no longer works with Ultimate Member 2.0+

    It filled out the billing and shipping fields in Woocommerce. Is anyone able to advise what needs to be updated in the code below?

    add_action ('um_post_registration_save', 'custom_update_profile',99);
    
    function custom_update_profile ($user_id) {
    
    	/*$user_id = um_profile_id();*/
    
    	global $ultimatemember;
    
    	um_fetch_user( $user_id );
    
    	
    
    	$profilefirstname = um_user( 'first_name' );
    
    	update_user_meta( $user_id, 'billing_first_name', $profilefirstname );
    
    	update_user_meta( $user_id, 'shipping_first_name', $profilefirstname );
    
    	
    
    	$profilelastname = um_user( 'last_name' );
    
    	update_user_meta( $user_id, 'billing_last_name', $profilelastname );
    
    	update_user_meta( $user_id, 'shipping_last_name', $profilelastname );
    
    	$profilecompany = um_user( 'company' );
    
    	update_user_meta( $user_id, 'billing_company', $profilecompany );
    
    	update_user_meta( $user_id, 'shipping_company', $profilecompany );
    
    	$profileaddress1= um_user( 'street_address_1' );
    
    	update_user_meta( $user_id, 'billing_address_1', $profileaddress1 );
    
    	update_user_meta( $user_id, 'shipping_address_1', $profileaddress1 );
    
    	
    
    	$address2= um_user( 'street_address_2' );
    
    	update_user_meta( $user_id, 'billing_address_2', $address2 );
    
    	update_user_meta( $user_id, 'shipping_address_2', $address2 );
    
      
      	$profilecity= um_user( 'City' );
    
    	update_user_meta( $user_id, 'billing_city', $profilecity);
    
    	update_user_meta( $user_id, 'shipping_city', $profilecity);
      
          
      
        $profilestate= um_user( 'State' );
    
    	update_user_meta( $user_id, 'billing_state', $profilestate);
    
    	update_user_meta( $user_id, 'shipping_state', $profilestate);
      
        
    
    	$profilezip_code= um_user( 'post_code' );
    
    	update_user_meta( $user_id, 'billing_postcode', $profilezip_code);
    
    	update_user_meta( $user_id, 'shipping_postcode', $profilezip_code);
    
    	$profilecountry= um_user( 'country' );
    
    	update_user_meta( $user_id, 'billing_country', $profilecountry);
    
    	update_user_meta( $user_id, 'shipping_country', $profilecountry);
    
    	
    
    	$profileemail= um_user( 'user_email' );
    
    	update_user_meta( $user_id, 'billing_email', $profileemail);
    
    	
    
    	$profilephone= um_user( 'phone_number' );
    
    	update_user_meta( $user_id, 'billing_phone', $profilephone);
    
    	
    
    	return $user_id;
    
    	}
  • The topic ‘Fill in Woocommerce Address Fields from Registration’ is closed to new replies.