Benutzerdefinierte Registrierungsfelder woocommerce

Hallo ich versuche, eine benutzerdefinierte Registrierungsseite für woocommerce zu machen, bis validation gut funktioniert, aber wenn ich versuche, die Daten in die database einzufügen passiert nichts. Dies ist der Beispielcode, den ich verwende ‘

 

<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="" />

<input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="" />

<input type="Number" class="input-text" name="billing_phone" id="reg_billing_phone" value="" />

<input type="text" class="input-text" name="reg_num" id="reg_num" value="" />

<input type="Number" class="input-text" name="Year_of_reg" id="Year_of_reg" value="" />

<input type="text" class="input-text" name="qualification" id="qualification" value="" />

'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' ) ); } if ( isset( $_POST['billing_phone'] ) && empty( $_POST['billing_phone'] ) ) { $validation_errors->add( 'billing_phone_error', __( 'Error: Phone is required!.', 'woocommerce' ) ); } if ( isset( $_POST['reg_num'] ) && empty( $_POST['reg_num'] ) ) { $validation_errors->add( 'reg_num_error', __( 'Error: Registration Number is required! if you are facing any problem give us a call or contact us on support@ozmant.com .', 'woocommerce' ) ); } if ( isset( $_POST['Year_of_reg'] ) && empty( $_POST['Year_of_reg'] ) ) { $validation_errors->add( 'year_of_reg_error', __( 'Error: MCI Year of Registration is required!.', 'woocommerce' ) ); } } } add_action( 'woocommerce_register_post', 'wooc_validate_extra_register_fields', 10, 5 ); function wooc_save_extra_register_fields( $customer_id ) { if ( isset( $_POST['billing_first_name'] ) ) { // WordPress default first name field. update_user_meta( $customer_id, 'first_name', sanitize_text_field( $_POST['billing_first_name'] ) ); // WooCommerce billing first name. update_user_meta( $customer_id, 'billing_first_name', sanitize_text_field( $_POST['billing_first_name'] ) ); } if ( isset( $_POST['billing_last_name'] ) ) { // WordPress default last name field. update_user_meta( $customer_id, 'last_name', sanitize_text_field( $_POST['billing_last_name'] ) ); // WooCommerce billing last name. update_user_meta( $customer_id, 'billing_last_name', sanitize_text_field( $_POST['billing_last_name'] ) ); } if ( isset( $_POST['billing_phone'] ) ) { // WooCommerce billing phone update_user_meta( $customer_id, 'billing_phone', sanitize_text_field( $_POST['billing_phone'] ) ); } if ( isset( $_POST['reg_num'] ) ) { // WooCommerce billing address update_user_meta( $customer_id, 'reg_num', sanitize_text_field( $_POST['reg_num'] ) ); } if ( isset( $_POST['Year_of_reg'] ) ) { // WooCommerce billing postcode update_user_meta( $customer_id, 'Year_of_reg', sanitize_text_field( $_POST['Year_of_reg'] ) ); } if ( isset( $_POST['qualification'] ) ) { // WooCommerce billing city update_user_meta( $customer_id, 'qualification', sanitize_text_field( $_POST['qualification'] ) ); } } add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' ); ?>

Solutions Collecting From Web of "Benutzerdefinierte Registrierungsfelder woocommerce"