Overriding Dokan plugin template is easy!

Published by WP Doctor on

This quick-reading post will help you to know about overriding a template of Dokan Multivendor pluginSometimes you may need to modify the core plugin file. Like as you need to remove an option from a file while it does not have any necessary action/filter. Now, you are thinking that “If I modify into the core file then I will lose everything during the plugin update”.

No need to worry! you can apply an alternate solution to modify the file via a child theme. Please keep a note –

You can only override a template file through your child theme. You can use this plugin to create child-theme.

Child theme without coding

How to override Dokan template file?

Dokan has multiple template files to operate its functionality like as –

  • Dashboard
  • Store page
  • Product upload and edit page
  • Store-list page and others.

If you can check the file structure of Dokan-lite or Dokan Pro then you will find the structure like this –

To get those files just open your website’s root folder and then open wp-content → plugins → dokan-lite 

Inside the dokan-lite folder, you are seeing that there is a folder called templates. If you have seen it then keep a note that you can override all the files which are available inside this templates folder through your child theme and the plugin update would not change anything (Until the plugin does not have any new changes inside template file)

Creating a folder inside the child theme

Just imagine that you are using a child theme called my-child-theme and you need to override a product template file which is inside dokan-lite/templates/products folder.

Now, inside the products folder, there are many template files like as new-product-single.php or new-product.php. Let’s pick new-product-single.php file to override.

Step 1: Create a folder called dokan” inside your child theme and then it will look like – wp-content/themes/my-child-  theme/dokan

Step 2: After completing step 1, just create a folder called “products” inside the dokan folder which you have created on step 1 (my-child-theme/dokan/products). Because this products folder contains the new-product-single.php file.

Check full video tutorial

Step 3: Now, copy the new-product-single.php file inside the products folder. It will look like my-child-theme/dokan/products/new-product-single.php file. 

If you have completed the 3rd step then you are done. Now, you can modify the dokan-pro templates file also by following the same method.

Note : The folder called “dokan” is same for both dokan-lite or pro version.


29 Comments

Navneet sharma · April 5, 2019 at 7:22 pm

Hi,

I have follow the steps and nothing change .

i have make a child theme under this i have make the folder dokan-lite>template>dashboard>dashboard.php.
but whne i try to add some text in this file and update its not reflecting.

any helps please!

    WP Doctor · April 8, 2019 at 11:59 am

    Hello Navneet,

    We did not write anywhere in our post that you have to create a template folder inside the child-theme/dokan folder. So, please correct the folder structure- child-theme/dokan/dashboard/dashboard.php 🙂

rogodessa · April 23, 2019 at 2:06 am

Hello!

I did according to what is written in this article. Created the necessary folders in the child theme, copied the template file wp-content/themes/martfury-child/dokan/settings/address-form.php

But changes are not reflected.

Please, help

    WP Doctor · April 23, 2019 at 9:05 am

    Hello,

    We have checked and working fine. Please make sure that you are changing something which is only coming from this file. If you are changing any function which calls back is on another file then it won’t work 🙂

      rogodessa · April 23, 2019 at 6:16 pm

      Thanks for the answer!

      Problem found. In the options table “stylesheet” was the value “martfury-child/..” (need “martfury-child”). Therefore, the locate_template() function returned a wrong path – /wp-content/themes/martfury-child/../dokan/settings/address-form.php

        WP Doctor · May 9, 2019 at 10:09 pm

        Great to hear that you found the problem 🙂

profmikel · June 26, 2019 at 1:11 am

IS it possible to overwrite a file which is not in the templates folder, such as in the class folder?

    WP Doctor · June 26, 2019 at 9:22 am

    Hello,

    It’s possible but in that case, you can extend a CLASS via child theme functions.php but you can not override the entire file.

Ionian Yasuo · July 18, 2019 at 11:39 pm

For some reason i cannot find the shipping settings
Can someone help?

    WP Doctor · July 19, 2019 at 9:15 am

    Hello,

    Shipping file is available inside dokan-plugin/templats/settings folder 🙂

artdesign12d · November 13, 2019 at 1:58 pm

Hi
I need help with the children’s theme, in the “function.php” section of the child theme, what code should I add,
because I want to change some views, for example, display the seller’s name on the store page, if in ‘function.php “I add the parent theme and it works fine,

and one more, can I change something in the “dokan-lite/includes” section while in the tutorial it’s only in the “dokan-lite/templates” section
Do I have coffee that I want to change
thank you

    WP Doctor · November 14, 2019 at 12:02 pm

    Hello,

    You can only override the file which is inside the templates folder of dokan plugin. To override a file, you have to create a folder “dokan” inside your child-theme and then paste the template file which is inside the template folder.

      artdesign12d · November 14, 2019 at 4:50 pm

      Hi,
      I have learned as in the tutorial provided, and it works
      this is a problem in the dokan theme, like on the front page,
      I want to add some code to display special products
      how to add it in the child theme, how
      thank you

        WP Doctor · November 14, 2019 at 6:02 pm

        Hello,

        You have to modify the front-page.php of your Dokan theme. You can copy and paste the front-page.php file into your child theme folder.

          artdesign12d · November 14, 2019 at 9:24 pm

          Do I need to add a new file “front-page.php” in the child theme first
          then I copy all the files in the parent function.php theme, then I paste it in the “front-page.php” child theme,
          or I copy directly the file “front-page.php” in the parent theme, then I paste in my child theme.
          thank you

          artdesign12d · November 14, 2019 at 9:31 pm

          I have modified the main theme function.php,
          is this what I copy then I appear on the theme of my child
          https://i.paste.pics/f7ac66cf0670eac90557aa40b787124b.png

          artdesign12d · November 18, 2019 at 8:24 am

          Hi,
          I just motified in this section
            / wp-content / plugins / dokan-lite / classes /
          to add to the theme of my child how,
          so as not to lose when there is a plugin update,
          thank you

          WP Doctor · November 18, 2019 at 8:48 am

          You can only override all the files of the “templates” folder via child theme. It is not possible to override a Class file via child theme. If you need then you can extend a class or use action/hook.

          artdesign12d · November 20, 2019 at 9:21 am

          Hi
          I’ve made a child theme with a one-click plugin,
          and succeeded,
          I have also copied “front-page.php” from the parent theme and pasted on the child theme,
          for “function.php” in the child theme, I don’t add any more code as it was when it was created by the child theme builder plugin,
          whereas in my main “function.php” theme, I’ve added a lot of code for my modification,
          so my question is, if there is an update to my main theme, will all the modifications in the child theme disappear,
          now I use the child theme and it works well
          thank you

          WP Doctor · November 20, 2019 at 4:37 pm

          Hello,

          Thanks, it won’t erase any code of your child theme if you update the parent theme 🙂

          artdesign12d · November 20, 2019 at 4:45 pm

          well, thank you very much for the information
          so I also happened to modify the plugin dokan, section / wp-content / plugins / dokan-lite / classes /
          how to add to my child’s theme
          or in other ways, expand the class or use action / hook.
          can you tell me the way
          thank you

artdesign12d · November 14, 2019 at 4:49 pm

Hi,
I have learned as in the tutorial provided, and it works
this is a problem in the dokan theme, like on the front page,
I want to add some code to display special products
how to add it in the child theme, how
thank you

joseamadorpuertas · May 22, 2020 at 6:44 am

Hi,

I tried doing the instruction.

I am edit the new-product-single.php. The changes I made is not showing up. Is there any additional changes that i should made aside from the mentioned instruction?

thanks

Rafa Carvalhido · December 31, 2020 at 6:05 am

Hi! My doubt is the same someone else asked before, but it wasn´t a clear question so you didn´t address it fully.

Is it possible to override files in the “dokan-lite/includes/Dashboard/templates” folder or is it only with the files in the “dokan-lite/templates” folder?
If it is, what is the folder structure for the file “…/plugins/dokan-lite/includes/Dashboard/templates/Products.php”

    WP Doctor · December 31, 2020 at 10:19 am

    Hello,

    You can only override the actual templates file which is in dokan-lite/templates folder. All the templates on the includes folder are not actually templates but they are containing some functionality of the main templates folders.

maansingh singh · December 31, 2020 at 11:10 am

i want to override includes/template-tags.php file in child them. but not working path is (child-theme/dokan/includes/template-tags.php)

    WP Doctor · December 31, 2020 at 11:19 am

    You can only override the files inside dokan-lite/templates folder not inside the includes folder.

Adding extra field on the vendor registration form in Dokan? - Start Today Or Never · June 18, 2020 at 6:56 pm

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

Leave a Reply

%d bloggers like this: