“Add extra MENU in Seller Dashboard- Dokan Multivendor plugin”

Are you a Dokan Multivendor plugin user?

In Dokan, the seller has their own dashboard panel where they can manage their own products, orders etc.

This is the default view of the seller Dashboard (Dokan Pro version).

Dokan seller dashboard

add custom menu in Dokan seller dashboard

Now, if you want to add an extra option (Menu like Orders, Coupons) for the seller then this tutorial is perfect for you! You can also add a template to show your own data on that location if you want!

Let’s get started!

Imagine that you want to add an extra menu like- “Vendor Guide” for your seller. If they click on that menu, then a new template “guide.php” (or any name that you prefer) will load which contains a proper guideline for the vendors.

How to add a new menu with a template? 

Not to worry if you are not too professional! Showing you simple code snippets which can help you by saving your time and money!

Remember that, Child Theme is the perfect and secure way of adding custom codes. The reason is too simple. Custom codes that are added to parent theme will be gone while updating! And I’m sure that no one wants that.

So here are the steps-

  1. Create and Install a Child Theme
  2. Create a file “guide.php” under your child theme directory.
  3. Open your child-theme/functions.php file

Now, on the functions.php file you can paste the below code snippets:

<?php

add_filter( ‘dokan_query_var_filter’, ‘dokan_load_guide_menu’ );
function dokan_load_guide_menu( $query_vars ) {
$query_vars[‘guide’] = ‘guide’;
return $query_vars;
}

add_filter( ‘dokan_get_dashboard_nav’, ‘dokan_add_guide_menu’ );
function dokan_add_guide_menu( $urls ) {
$urls[‘guide’] = array(
‘title’ => __( ‘Guide’, ‘dokan’),
‘icon’ => ‘<i class=”fa fa-user”></i>’,
‘url’ => dokan_get_navigation_url( ‘guide’ ),
‘pos’ => 51
);
return $urls;
}

add_action( ‘dokan_load_custom_template’, ‘dokan_load_template’ );
function dokan_load_template( $query_vars ) {
if ( isset( $query_vars[‘guide’] ) ) {
require_once dirname( __FILE__ ). ‘/guide.php’;
exit();
}
}

?>

 Love this code? Was it helpful? Would like to know your feelings here!

Now, if you load vendor/seller dashboard, you will see an extra menu added there named as “Guide”!

dokan-extra-menu

Clicking on “Guide” you will see the content or your own template that is written on guide.php file.

custom menu in dokan seller dashboard

*** Don’t forget to add this line into your guide.php. Otherwise, the left dashboard bar will be disappeared.

<?php

do_action( ‘dokan_dashboard_content_before’ );

?>

Summary

So? It’s easy enough. Isn’t it? Now you can add custom menu in Dokan Seller Dashboard yourself!

Comments will be appreciated! And knock us for any kind of help with Dokan Plugin.

Happy coding 🙂

2018-12-22T04:19:43+00:00

About the Author:

WordPress Coder, Debugger, Problem Solver!

Leave A Comment