Add Filter Option To WooCommerce Main Product Page that shows all products

Robert Granlund
Robert Granlund used Ask the Experts™
on
WordPress WooCommerce Add a Custom Filter Button to the Products Main Admin Page.

When you are on the Main Products Page in WooCommerce, I want to add a new filter button, "Mine"  that will list all of the products that the current admin has added to the store.
There is more than one person who ads products so it helps when one person wants to only see the products they have added.

Any help will be appriciated.
Add.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Hey there,

Strangely enough, this is already built into WordPress, but the WooCommerce plugin disables it, so it's just a case or re-enabling it (sort of). In your functions file, add the following:

add_filter( 'views_edit-product', 'add_author_filter', 10, 1 );
function add_author_filter( $views ) 
{
    $views['show_mine'] = $views['mine'];
    return $views;
}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial