Home Forums Weaver Xtreme Theme How to add a custom registration form?

This topic contains 1 reply, has 2 voices, and was last updated by  scrambler 3 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #61291

    alvinarichard
    Participant

    Can you tell me how to add a field in Registration form? I am having error in this code

    function wooc_validate_extra_register_fields( $username, $email, $validation_errors ) {
    if ( isset( $_POST[‘billing_first_name’] ) && empty( $_POST[‘billing_first_name’] ) ) {
    $validation_errors->add( ‘billing_first_name_error’, __( ‘Error: First name is required!’, ‘woocommerce’ ) );
    }
    if ( isset( $_POST[‘billing_last_name’] ) && empty( $_POST[‘billing_last_name’] ) ) {
    $validation_errors->add( ‘billing_last_name_error’, __( ‘Error: Last name is required!.’, ‘woocommerce’ ) );
    }
    return $validation_errors;
    }
    add_action( ‘woocommerce_register_post’, ‘wooc_validate_extra_register_fields’, 10, 3 );

    I have used this article as reference https://www.cloudways.com/blog/add-woocommerce-registration-form-fields/

    #61292

    scrambler
    Moderator

    This is not really the forum for this, you would probably be better of looking on WordPress.org.

    You may want to also just use a plugin

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

You must be logged in to reply to this topic.