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

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 my another video to add new field on the vendor registration form –

9 thoughts on “How to add a new field on product upload form – Dokan Multivendor

  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
    Regards
    Paul

    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
    Marc

    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.

Leave a Reply

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