John Davidson

php - adding custom File field to Woocommerce dokan plugin

0 comments
Message:


I’m trying to add an extra field on dokan registration for vendors to upload an identification document.. i found the code specified for adding an extra field to the form but it is for a "text" input type… i changed the input type from "text" to "file"




<p class="form-row form-group form-row-wide">
<label for="veri-file"><?php esc_html_e( 'Upload Verification ID', 'dokan-custom-codes' ); ?><span class="required">*</span></label>
<input type="file" class="verifile" name="veri_file" id="veri_file" accept="image/png, image/jpeg" value="upload"<?php if ( ! empty( $postdata['veri_file'] ) ) echo esc_attr($postdata['veri_file']); ?>" required="required" />
</p>


My Answer:
text field. How can I modify this code to add a file upload field instead?

Here is the code for adding a text field:

php
add_action( 'dokan_seller_registration_field_after', 'add_custom_field_to_registration_form' );

function add_custom_field_to_registration_form() {
?>





}


To modify this code to add a file upload field, you can use the following code:

php
add_action( 'dokan_seller_registration_field_after', 'add_custom_field_to_registration_form' );

function add_custom_field_to_registration_form() {
?>





}


This code will add a file upload field to the registration form for vendors to upload their identification document. Make sure to handle the file upload and validation in the registration process to save the uploaded file.

Rate this post

3 of 5 based on 2131 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us