dokan custom field

How to add a new field on the product upload form – Dokan Multivendor in 2021

This will be the most awaited blog post for Dokan users. Dokan powered marketplaces are advanced and its users are building different kinds of a marketplace with unique requirements. To meet the marketplace requirements, sometimes it is necessary to modify the plugin. One of the common modification is adding a new field on the product upload form of Dokan.

It is easy to add a new field on the backend WooCommerce with ACF but Dokan does not populate that field automatically. To add a new field, you might need to add a little bit of code. So, I thought to write a full blog with code example so that it can save users time and money.

How to add a new field?

If you are trying to read my post and add a field then install a child-theme on your website. I have done the code in 4 steps –

  1. Added a field on product upload form (With pop-up or without pop-up)
  2. Saved and updated field value while saving the product
  3. Showing the extra field on product edit page
  4. Also, showing the extra field data on single product page 🙂

Now, open your child-theme functions.php and paste the below code –

Now, check the product upload form where you will get the new field after that TAG field –

Extra field on upload form

Please note that I have used this action to add the field after the tag field – dokan_new_product_after_product_tags which will add the field after the tag. If you want multiple fields then you can add multiple

Now, you can fill the form and create your product which will redirect you to the product edit page with the new custom field value –

Product Edit Page

I have used these actions to save and update product meta – dokan_new_product_added & dokan_new_product_updated

Best theme for Dokan Multivendor

To show the field on the edit product page, I just used this action – dokan_product_edit_after_product_tags

The last part of the code is to show new field data on single product page. To show on the single product page, I have used this action- woocommerce_single_product_summary

Single product page

If you need to change the field type or need to add more fields, then you can follow my above code and write your one.

Check this full video to learn how to add multiple fields!

Subscribe the channel
Check this video to add multiple fields

Share This Post

Related Post

74 thoughts on “How to add a new field on the product upload form – Dokan Multivendor in 2021

  1. Hi Nayem,

    Thanks for sharing such important information and looking forward to more blogs on the Dokan plugin.
    I want to add a new field in the product upload form, where the vendor can add an extra fee (for example packing and handling fee). This field needs to be carried forward to the single product page and the cost needs to be replicated in cart.
    If you could share such a code to be added to functions.php that will be nice.
    Thanks in advance

    1. Hello Paul,

      I have already shared the way how you can add a field, save the field, and show it on single product page. The way you are looking for is a similar modification with extended functionality. I am unable to do anything here for now but you can follow my step and add your own field.

  2. Great article – Thanks for putting this together.

    Could you please elaborate on how to display the “Product Code” on the Product page using the hook method you have mentioned ..

    “The last part of the code is to show new field data on single product page. To show on the single product page, I have used this action- woocommerce_single_product_summary”

    1. To show data on single product page, WooCommerce has hook-like after the title, after description, etc. I have used woocommerce_single_product_summary and print the field value on through the hook. I checked global $product and then checked product ID 🙂

  3. Hi Nayem, thank you so much for this long-awaited tutorial. I followed your instructions and now have a new field.

    My php knowledge is quite limited at this stage of my life, I was wondering if you can give me a hint on how to reposition the new field.

    I would like to place the new field below the ‘Product Name’ field. Any help is greatly appreciated.

    Thank you

    1. Hello,

      The hook I have used only allows add the filed after the category. There is no available filter to place the field after the title. Now, the only way is overriding template file directly via your child theme then insert the HTML field.

      1. Ok, understood. I will override template file via child theme. Thank you kindly for your fantastic article, your code, and for answering my question!

    2. Hello,

      The hook I have used only allows adding the filed after the category. There is no available filter to place the field after the title. Now, the only way is overriding template file directly via your child theme then insert the HTML field.

      1. Do you have anything that you can reference to give an example? I’ve tried to tweak the code several times to reflect a drop down/select box and options, but nothing works.

      2. Hello again – if you can’t help with creating a dropdown, would you mind extending this snippet to include a shortcode that can be used with Elementor to display the field data? That would be really great! Thank you.

  4. Hello,
    I read your post and found it very interesting and useful because I have the same need “To Add A New Field On Product Upload Form”.
    But when I go to edit my functions.php file which is located in child theme ( I am using atra -child theme) it gives me an error and does not load my page.
    Am I doing something wrong or should I copy this code to a different file?

  5. Hello! I am making WordPress Multivendor marketplace and I am using woocommerce + dokan. I have one problem, and I don’t know how to fix it.

    The problem is how to define “New Product” to vendors because there are necessary fields they have to fill. New Product pop up have to be precisely predefined with different fields for entry.

    I will give concrete example. There are 4 primary categories, and vendor choose one of them, and depending on the category, it should appear different fields which he needs to fill in New Product pop up.

    The problem is bigger because, he needs to get specific fields for entry, even depending on subcategory which he choose, because, every category doesn’t have the same informations.

    Are there any plugin which can fix this problem, or simply to customize code on some way ?

    Thank You very much. I really appreciate Your help and Your time.
    Best regards

  6. Thanks for this great article. 1 question though…

    I have ACF field group and how can I add it in the Dokan Product Upload Form?

      1. Thanks for reply, is there any alternative to have customs field in dokan product upload form with conditional logic?

  7. Hi,
    I got a question that is about adding new fileds in dokan, but not concerning the procuct upload.
    I tried to contact you with the contact form, but that didn’t work.

    Here is my question:
    Dokan offers an option called vendor verification, so basically an option for admins to verify vendors. As default there are only three verifaction steps, one for the ID, one for the store adress and one for social networks. (
    I was wondering if it is possible to add additional steps, so I can verify the origin of my vendors products for example?
    Maybe this might be a good topic for one of your next blog posts, beacuse I’m sure this is interesting for more dokan admins.

  8. Hi Nazmul,

    Great article and just in time.
    What I actually wanted to do is improve the vendors capability of uploading images and I wanted that a click on the default image button (square) would invoke something like that: – that will allow vendors to load directly from their Instagram account.

    Do you think it is possible?


  9. This message appeared .. why?

    Your PHP code changes were rolled back due to an error on line 30 of file C:\wamp64\www\wordpress\wp-content\themes\ProductID\functions.php. Please fix and try saving again.

    syntax error, unexpected ‘<', expecting end of file

  10. Hi, is it possible to add such a field with a plugin like “snippets” so that I don’t have to use a child theme?

    Best regards,

      1. Hi, thanks for the quick response!
        I’m not quite sure what this means “as long there has a function with action/hook”, but I tried it and it works.

        I want to add more of these fields, what do I have to change or which parts of your code have to be changed if I want to implement a second field?

        Is there a way to effect the position of the fields in the product edit page and in the product detail page?

        Best regards,

        1. You can follow the same method and multiple HTMl field with different field name like new_field_1, 2 and then save the meta value-

          if ( ! empty( $postdata[‘new_field’] ) ) {
          update_post_meta( $product_id, ‘new_field’, $postdata[‘new_field’] );
          if ( ! empty( $postdata[‘new_field’] ) ) {
          update_post_meta( $product_id, ‘new_field’, $postdata[‘new_field_1’] );
          if ( ! empty( $postdata[‘new_field’] ) ) {
          update_post_meta( $product_id, ‘new_field’, $postdata[‘new_field’_2] );

    1. Wow thank you that is great!
      In your video you did not show how to display both fields in the frontend for the customer, like on the product detail page – can you explain how to do this?

      I followed your steps like in the video, but I can not enter differents values for the two fields, the first one overrides the second.
      I’m also currently facing the problem that I can not change the value of any of the both fields, like if it is “12345” and I want to change it to “6789” and save the product it still remains on “12345”?
      Hope you can help me out!

      Best regards,

  11. trying to add a form field of dropdown in the product such as conditions of the product.

    I have coded it accordingly to reflect input type as dropdown in my conditions field. However, i am not sure where to input the options for the dropdown (new, used or open box). can you please help.

    Here is the code:

    * Adding extra field on New product popup/without popup form

    add_action( ‘dokan_new_product_after_product_tags’,’new_product_field’,10 );

    function new_product_field(){ ?>

    <input type="text" class="dokan-form-control" name="new_field" placeholder="”>

    <input type="text" class="dokan-form-control" name="new_field_1" placeholder="”>

    <input type="dropdown" class="dokan-form-control" name="new_field_2" placeholder="”>

    <input type="hidden" name="new_field" id="dokan-edit-product-id" value="”/>

    __( ‘product code’, ‘dokan-lite’ ), ‘value’ => $new_field ) ); ?>

    <input type="hidden" name="new_field_1" id="dokan-edit-product-id" value="”/>

    __( ‘product License’, ‘dokan-lite’ ), ‘value’ => $new_field_1 ) ); ?>

    <input type="hidden" name="new_field_2" id="dokan-edit-product-id" value="”/>

    __( ‘product code’, ‘dokan-lite’ ), ‘value’ => $new_field_2 ) ); ?>

    get_id(), ‘new_field’, true );

    if ( ! empty( $new_field ) ) {


  12. You have to follow a similar method. Just duplicate the below codes and change the meta –

    $new_field = get_post_meta( $product->get_id(), ‘new_field’, true );

    if ( ! empty( $new_field ) ) {

  13. Hi
    Thank you so much, you saved me weeks of work, I managed to do this in 10 minutes. I now only need to make the new field be compulsory to fill for the vendors, what do I need to add to the above code?

      1. Hi thanks, now I am trying to add an additional field but I am failing, it keeps breaking the site, is the code clashing with the one I placed for the other field?

  14. Hello! I need to show the custom input in the create new product page if the category of the product is x, how can i do it?
    PS. i tested the code without any change, but diden`t showed the input custom input in the edit product page, i`m using the newest version of dokan.

  15. Other thing, can i display the products in the home page based in the data of the new input? for example, i made a new input to display a dropdown that says if the product is new or used, and i want to display only used products in the home page tab.

  16. Hello,
    As you know, product brands cannot be imported with the export-import module (or woocommerce export-import).
    If I add a new domain like this, can I see them in the csv file. Can I export or import it?

  17. Hi
    I successfully added checkbox type field in add new product form in dokan vendor panel
    There seems two problem appears
    1- In edit product page my checkbox field is unchecked after published.
    2- It does not show anything in single product page
    I changed input type from text to checkbox.

  18. Hi again
    I successfully added checkbox type field in add new product form in dokan vendor panel
    There seems one problem appears
    1- In edit product page my checkbox field is unchecked after published. This causes makes me unable to change checkbox and publish again from edit product page, it means a can not change anything after publish once.

    I changed input type from text to checkbox.

  19. hello,
    I added many taxonomies from admin aside and used it for filtering
    but I can’t view them on dokan vendor dashboard , any help please ?

    1. You will need to replace the hook for the Booking product in the code you found on this website.

      On the line #6,
      You will need to replace dokan_new_product_after_product_tags with dokan_new_product_form

      and on the line #22,
      You will need to replace dokan_new_product_added with dokan_booking_after_product_data_saved and then remove line #23

      Also, you need to save the field data in a different way but hooks I have given are correct.

      1. For anyone reading this – this is how i got the above working:

        #– Add a field to the booking product form –#
        function new_field_booking_product_form($post, $post_id){
        $new_booking_field = get_post_meta( $post_id, ‘new_booking_field’, true );

        <input type="hidden" name="new_booking_field" id="dokan-edit-product-id" value="”/>

        __( ‘Product code’, ‘dokan-lite’ ), ‘value’ => $new_booking_field ) ); ?>

        get_id(), ‘new_booking_field’, true );

        if ( ! empty( $new_booking_field ) ) {

        add_action( 'woocommerce_single_product_summary', 'display_booking_meta_data', 13 );

  20. I want to add multiple category in dokan plugin , currently we have one category dropdown in wpadmin (taxonomy) , now i want to create multiple categories and integrate with frontend.

  21. Cool..That’s a great hack. Thanks for the great thing done! It helps us a lot.

    But I’m sorry! I have the same question for you about wePOS even if it’s not related to this post” Is there any way we can change the status of the completed order to possessing order by default from the store dashboard of the vendor? to prevent withdrawal request of their earnings which was already taken by cash via POS”


  22. Thank you for this tutorial. I’m using the bookings module in Dokan and want to do the same by adding a custom field in the bookings products. Can you please help me with this.

  23. Hey, I hope you are fine.
    Thank you for this tutorial, I wanted to ask these fields can be used for search filters ?

  24. Hey, I hope you are fine.
    How to show this custom-created field value on the checkout page? Anyone can help me to solve this. Because I need to show some product detail on checkout too.

  25. Hi Nazmul,

    Do u know how to add a custom tag field (taxonomy with no hierarchy) on both the new product and edit page and get them saved and displayed frontend?

  26. Hi Nayem, thanks for the post, can you give some simple sample for more than just text field, like sample for a category field, checkbox field, selection fields. Thanks

  27. It can be an upload and file field. Does the supplier register a pdf file with a specific extension for the person to download for free on the product page?

  28. Hi there, thanks for this it works perfectly.. I have a question? It seems with Dokan it only allows multiple picture upload on a single product but, with variations it only allows 1… is there a way that can allow multiple pictures to be shown in the set variation?


  29. Hi there it works great.. I have a question? Is there a code I can add multiple images in the variation? For instance: in the woocommerce variation, you can add extra images nut, in the Dokan variation it only allows 1 image…

    kind regards


  30. Very Good Content, Nayem.

    I wanted to change the defaut feature image uplaod field to feature Video uplaod. I hope yo can help me on this.

  31. Thanks for the code, it worked perfectly and was nice;. but I need help as I will like to display the output on the product page to only a certain user type; eg: I want only customers and admin to see it. How do I make that work.

  32. Hi Nayem thank you so much for this super useful tutorial! One question: Do you have any pointers on how to add the “Product Status” field (it’s a dropdown) to the product upload form?

  33. bro fine your idea is best!
    but bro how can I get this field in vendor additional info? please help

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: