Adding extra field on the vendor registration form in Dokan

I was getting a high request to write a blog to show how you can easily add an extra field on the vendor registration form and show that data on the user profile. It is really necessary for some marketplace to register vendor with their TAX ID or GST Number. Dokan does not provide any default field for that kind of data but you can easily add your own field.

How can I add?

You need a child-theme before doing this process. If you have installed a child theme already then you can override the seller registration form through it.

Please create a folder called dokan into your child-theme and then create another folder into dokan folder called global. Now, copy the seller-registration-form.php file from your wp-content/plugins/dokan-lite/templates/global folder and paste it to your child-theme like below –

Overriding template

You can read full details on how to override the template here.

Now, from your child-theme open the seller-registration-form.php file and add the extra field on your desire position like below –

Adding input field on registration form file

You can use this code if you want to just copy and paste (Field for GST Number) –

 <p class="form-row form-group form-row-wide">
        <label for="shop-phone"><?php esc_html_e( 'GST Number', 'dokan-custom-codes' ); ?><span class="required">*</span></label>
        <input type="text" class="input-text form-control" name="gst_id" id="gst_id" value="<?php if ( ! empty( $postdata['gst_id'] ) ) echo esc_attr($postdata['gst_id']); ?>" required="required" />
    </p>

After adding the input field you will be able to see the registration field on the vendor registration form-

Field added on registration form

Now, you have to save the field data and need to show on user profile.

How to save field value and show on backend user profile?

Just open your functions.php file and paste the below code –

If you want to change the field name or meta key then you have to change the meta key or field name accordingly on every place. On this code, I have used the meta key for the field as dokan_custom_gst_id and use the field id as gst_id

After saving the above code, you will be able to use vendor GST Number on his/her user profile –

By following this post you will be able to add multiple fields with different meta key.

You can also follow this video to show the above steps –

4 thoughts on “Adding extra field on the vendor registration form in Dokan

  1. Hi Nayem this is fantastic.
    How can the GST field be made visible on the vendor store page on the frontend of vendor settings

    1. I am sorry, it was not wrong. I added the field on the registration form of my-account but the file location you have provided is for the separate registration form.

Leave a Reply

Your email address will not be published. Required fields are marked *