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 –

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

  2. Thanks for this information. I was looking for this.
    But this process is same in all theme or we have to install dokan theme only?

    And is it important to use both child and parents theme?

  3. How can I get the phone number of a store so that the buyer can send a message with a button? Im trying with shortcode and snippet, but i cant do it.

  4. How can i add brand dropdown list in vendor product upload form? i want my vendor can select brand of their product from dropdown field.

  5. Hi, Nazmul Hassan
    I want to add a dropdown selector to the single product page as a required field which vendors can input choices for the customer to select. Many of my vendors have several pick-up points, one of which would be the customer’s preference. No shipping, local pick-up only. I don’t want it as a product variation and only want vendors to create a single product. The selected location would have to be included int the customers order details. Thanks for any ideas, Peter.

  6. I followed all the steps. The website crashed (child theme failure). I had to rebuild entire website from scratch. Why Dokan does not add seller GST number field in registration form?

  7. I had added separate functions to add additional field that were visible for both customer and vendor registration. It works fine. However the first/last name and phone fields were being duplicated in customer and vendor registration. This blog post helped me understand that vendor registration form separately and now I can add customized fields only for vendor registration. Thank you.

    I have added the code you provided in this post and the new additional custom field is visible in vendor registration. I replaced gst_id with new customer field ID (sell_items). I also managed to remove duplicate fields.

    However I think somewhere this code is probably clashing with the other code I have to add additional field for customer and vendor registration. Now while a new customer is being registered and added to the site, new vendor registration is not going through.

    Do you think you can point me on how to fix this?

    Code I had added: https://www.cloudways.com/blog/add-woocommerce-registration-form-fields/

    Plus code you listed in this post to add a new field only visible to vendors.

  8. Hi Nazmul,

    Great post. Solved one of my big problem. I have one more query. I am using the Dokan Invoice module and I want to display the seller GST that we just added on the invoice. How can we go about adding that in the PDF invoice please.

    Thanks

  9. hello sir i make a new gst field with help of your code but i just want another field i copy my old code change the id and filed name all from all the place but now its not working

    1. Please do not copy the same code twice if you do not have a development idea. You can not use the same function name multiple times. So, try a unique function name.

  10. Hello Very useful Article to add custom field.
    I want to add and update social url like facebook and instagram in vendor registration form. which meta key i should used ?

  11. Sir, I followed each step very carefully. It was ok till I added frontend field. but when i added the backend code on function.php it shows a critical error on my site and the site get crushed. [N.B. I didn’t put or remove any single character in your code.}
    Can you please give me the solution?

  12. Hi! I tried this solution but I get a strange result. The new custom fields are greyed out (inactive), and can’t be interacted with. I even tried a different way pasting this exact solution without customizing anything. Do you know what could cause that?

Leave a Reply

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