Tagged: Vendor registration
- This topic has 3 replies, 2 voices, and was last updated 11 months, 3 weeks ago by
Anushka Sinha.
-
AuthorPosts
-
-
July 16, 2025 at 8:51 AM #248661
Sathanda SA de CV
ParticipantI’d like to automatically save the vendor’s first and last name to the standard WordPress user profile fields (first_name and last_name) when a vendor registers.
Could you please let me know the recommended way or hook to achieve this?
Thank you in advance for your help!
Best regards,
Jose Mendoza -
July 16, 2025 at 4:11 PM #248681
Anushka Sinha
ModeratorHi there,
Thank you for reaching out to us.
To save the vendor’s first and last name as user profile fields, please add the following code snippet to the functions.php file of your currently active theme:
https://multivendorx.com/docs/code-snippet/add-first-name-and-last-name-field-in-vendor-registration-form/You can do this by navigating to: Appearance >> Theme File Editor >> functions.php, then paste the snippet at the end of the file.
If you need any further assistance, feel free to reach out – we’re happy to help!
-
July 18, 2025 at 3:30 AM #248773
Sathanda SA de CV
ParticipantThank you!
I ended up adding this code snippet, and it worked:
add_action( ‘mvx_after_register_vendor’, ‘shshapp_save_vendor_names’, 10, 1 );
function shshapp_save_vendor_names( $user_id ) {
if ( ! $user_id ) {
return;
}// Verifica que existan los campos personalizados enviados
if ( ! isset( $_POST[‘mvx_vendor_fields’] ) || ! is_array( $_POST[‘mvx_vendor_fields’] ) ) {
return;
}$fields = $_POST[‘mvx_vendor_fields’];
$first_name = ”;
$last_name = ”;// Itera los campos para encontrar “Nombre (s)” y “Apellidos”
foreach ( $fields as $field ) {
if ( isset( $field[‘label’] ) && isset( $field[‘value’] ) ) {
if ( $field[‘label’] === ‘Nombre (s)’ ) {
$first_name = sanitize_text_field( $field[‘value’] );
}
if ( $field[‘label’] === ‘Apellidos’ ) {
$last_name = sanitize_text_field( $field[‘value’] );
}
}
}if ( $first_name ) {
update_user_meta( $user_id, ‘first_name’, $first_name );
}if ( $last_name ) {
update_user_meta( $user_id, ‘last_name’, $last_name );
}
}
-
-
July 18, 2025 at 10:17 AM #248793
Anushka Sinha
ModeratorHi there,
Thankyou for the update.
Great to hear that you’ve achieved the desired flow.
If you need any further assistance, please feel free to let us know – we’re happy to help.
-
-
AuthorPosts
- The topic ‘How to Save Vendor First and Last Name to WordPress User Profile’ is closed to new replies.




