Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add custom admin menu to woocommerce

Is it possible to add a new admin menu to the woocommerce admin section in Wordpress? I've done this with WP E-commerce with my custom plugin so am wandering if the same is true for Woo commerce.

Thanks

like image 466
Lock Avatar asked Jun 04 '13 23:06

Lock


Video Answer


2 Answers

Well, if you use something like this:

add_action('admin_menu', 'register_my_custom_submenu_page');

function register_my_custom_submenu_page() {
    add_submenu_page( 'woocommerce', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' ); 
}

function my_custom_submenu_page_callback() {
    echo '<h3>My Custom Submenu Page</h3>';

}

Then you will see a submenu under "Woocommerce" admin menu. For some reason you can´t do same using post_type=shop_order.

"shop_order" is the one you should use to put a submenu under "Woocommerce" one.. but, as i said, don´t know why didn´t work with that particual post_type.

http://codex.wordpress.org/Function_Reference/add_submenu_page

like image 157
rgdesign Avatar answered Oct 15 '22 04:10

rgdesign


For me the following worked:

add_submenu_page(
    'edit.php?post_type=product',
    PAGE_TITLE,
    MENU_TITLE,
    'manage_woocommerce',
    'custom_wc_menu'
);

Setting the $parent_slug to edit.php?post_type=product

like image 24
michalzuber Avatar answered Oct 15 '22 05:10

michalzuber