Claim your freedom to choose the perfect partner for your multi-vendor journey.

FREEDOM25

Celebrate the festive season by giving your marketplace a powerful lift!

FESTIVE20

5.0.x
Multi-store. Franchise. Facilitator. AI tools.
Everything your marketplace needs - now in one platform.
Power your marketplace dreams with unbeatable Black Friday deals!

MVXBLACK30

Supercharge your marketplace vision with unstoppable Cyber Monday deals!

MVXCYBER30

Holiday cheer, bigger savings
Take 25% off-because your marketplace deserves a gift too.

happyholiday

-
DAYS
-
HOURS
-
MINUTES
-
SECONDS
20% Off Is Temporary. The Benefits Aren't.

HAPPY20

Join the MultiVendorX Facebook Community

Contact, share, and grow with thousands of MultiVendorX users around the world.

How to Save Vendor First and Last Name to WordPress User Profile

Resolved
Viewing 2 reply threads
  • Author
    Posts
    • #248661
      Sathanda SA de CV
      Participant

      I’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

    • #248681
      Anushka Sinha
      Moderator

      Hi 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!

      • #248773
        Sathanda SA de CV
        Participant

        Thank 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 );
        }
        }

    • #248793
      Anushka Sinha
      Moderator

      Hi 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.

Viewing 2 reply threads
  • The topic ‘How to Save Vendor First and Last Name to WordPress User Profile’ is closed to new replies.
Shopping Cart
Launch Your Marketplace
in Days, Not Month
Get expert guidance to build, scale, and grow your MultiVendorX marketplace
Book Free Strategy Call
Trusted by 10000+ marketplace Owners
Scroll to Top