Overriding Dokan plugin template is easy!

Published by Nayem on

This quick-reading post will 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

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.

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.


Nayem

I really love to discuss and research about the new thing. I love #customer #support #php #wordpress #bug. Cheers!! Personal Website: https://nayemdevs.com Contributor @ WordPress.org Linked in: https://www.linkedin.com/in/nayemdevs Twitter: @nayemdevs

2 Comments

Joseph Miller · July 28, 2018 at 5:25 am

Wierd I thought I already posted a comment and have been waiting for a response. Anyways awesome article But I am not to good at php and have tried for a long time to figure out how to customize dokan without messing up. If you could give me the time of day I would be very grateful ….This stuff stresses me out and the reassurance that the person doing it is the man behind the scenes himself helps a lot. I don’t know if my needs are going to be too big or even possible. So the optimal setup for my site would be where vendors could only select global attributes and not create new attributes. With that said I still want them to be able to make variable products. If there is a way to make it possible for them to only use one specified global attribute for variations example Size 1 oz, 2oz, 3oz and so on. while all other global attributes can only be added to each product for filtering that would be perfect. if it is not possible allowing them to make variable products out of any global attribute will work. Other then That if the virtual and downloadable product options could be removed and all product options but simple and variable. and lastly, could I add a tab for special info related to each product or change the name of an existing tab? I am not a rich man if I was I would gladly pay more but all I can offer you is like $40. -Thanks for your time Joe Miller

    Nayem · July 29, 2018 at 2:49 am

    Hello @Joseph,

    I think you can easily remove the virtual/downloadable field by overriding the new-product-single.php file and also the custom attribute making option. However, I am unable to discuss such things on things public forum area. Money is not the matter but if you think you need help then you can fill the contact form- https://wpdoctor.press/contact-us with the details then I will try my best to help you 🙂

Leave a Reply

%d bloggers like this: