Overriding Dokan plugin template is easy!
This quick-reading post will you to know about overriding a template of Dokan Multivendor plugin. Sometimes 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 –
- Store page
- Product upload and edit page
- Store-list page and others.
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.