banner-1544x500

ACF For Dokan – A solution to add new field in Dokan product form

Facing an issue with adding a new field for vendor product management? Here is the
the solution, ACF For Dokan.
The idea came to mind as I have to do the same process of adding a new field on the
product upload form for multiple projects. The process is the same and very well explained
here. But to make things easy for Dokan marketplace users, I have been trying this plugin for
quite a long time and finally, it is published and hopefully, it will be useful.


ACF For Dokan, will allow admin to create custom fields using the most popular plugin called
ACF (Advance Custom Field). When as an admin user, you are creating a custom field for
the product post type, default that custom field values can be entered or edited by the admin
user from the WordPress admin panel.
But if you have installed and activated the ACF For Dokan plugin, there will be a setting for the
field named Vendor Edits Allowed? If you switch it to Yes, the custom field created will be
visible in the vendor dashboard while they are creating a new product or editing any existing
product. Isn’t that easy enough?

How to use ACF fields for Dokan?

This is the initial version of the plugin so few field types are supported like text, textarea,
number, url, select, email, WYSIWYG editor. The WYSIWYG editor will only work in edit
product pages.
Now, you have created the field that the vendor will be able to access for the product. You
will be worrying about how to display that field value on the product detail page. It is very
simple, you can use the function of ACF:


the_field ( ‘product_code’ ); // product_code is the field name
or
echo get_field ( ‘product_code’ ); // product_code is the field name

You can also use get_post_meta ( ‘product_code’ ); WordPress function to get the value.
Please share your thoughts on the plugin here.

Full Tutorial

Share This Post

Related Post

0 thoughts on “ACF For Dokan – A solution to add new field in Dokan product form

  1. Hi! Nayem,
    I’ve noticed that you use a Dokan child theme on many of your solutions. Is this required to implement these changes or do I just adapt it to my theme. On my site I am using OceanWP-child with a dokan folder. I’m sure it is OK just looking for confirmation from the expert.
    Does ACF-for-Dokan work on any theme? I can imagine the potential and will look at it.

    1. A child theme is safe to override or write extra code. So, it is not necessary to have Dokan-child theme. It should the child theme of your currently active theme.

  2. Hey Nayem! Awesome solution! I actually stumbled upon it today after days of searching a viable solution for Dokan and ACF!

    I know the plugin is in early stages, but I wanted to see if you could have some guidance on an issue that’s been pestering me for weeks now:

    You can use acf_form() in the new-product-single.php template file, but you’ll get another ACF Form different from the product editing form provided by Dokan.

    My go to solution was to use acf_form(array(‘form’=> falase)); within the product edit form. This way, Dokan’s form tags would wrap the acf form and in theory, the fields would be saved.

    However, I haven’t been able to accomplish this. Whenever I hit “save product” in the vendor product editing form (new-product-single.php), the ACF_Form is not saved.

    The weird part is that the ACF_Form is saved IF it is rendered outside Dokan’s Form tags. Have you encountered a similar issue when developing the plugin?

    Thanks a lot!

  3. Thank you very much for this important place.
    Can you help me I have no experience in coding.
    I want to create a field (package quantity)
    Can you write the function?

  4. Hey Nayem,

    This has been super helpful! Thanks.

    I was just wondering if there was a way to use these ACF’s as custom filters for the shop too? I am trying to use The WooCommerce AJAX filters plugin, they have said no, but I wondered if there was another way that I am not thinking about?

  5. Hey Nayem, This has been super helpful! Thanks. I was just wondering if there was a way to use these ACF’s as custom filters for the shop too? I am trying to use The WooCommerce AJAX filters plugin, they have said no, but I wondered if there was another way that I am not thinking about?

  6. Hello there,

    I have Nayem, i’ve watched some of your videos and read your article above. I am having trouble getting acf for Dokan to allow me to create custom fields for specific categories. I don’t them to appear on all products. I’ve set the rules to apply to post type equals product AND post taxonomy is equal to the category I want it to feature it. It just ignores the second rule.

    Is this possible with your plugin?

    Hope you can 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: