Lock
Lock

Reputation: 5522

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

Upvotes: 10

Views: 19670

Answers (2)

michalzuber
michalzuber

Reputation: 5215

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

Upvotes: 4

rgdesign
rgdesign

Reputation: 1064

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

Upvotes: 27

Related Questions