0

WooCommerce settings are located at wp-admin/admin.php?page=wc-settings and each of the Tabs for its settings is a continuation of the URL query string (ex: wp-admin/admin.php?page=wc-settings&tab=products for Products).

I know how to use the woocommerce_settings_tabs_array hook to manipulate the tab itself, but these Tabs also have sub links called "Sections."

For example, Products has General, Inventory, Downloadable Products and Product Vendors for me since I have a premium plugin.

How do I remove these sections from underneath the tab? Specifically, I want to remove the Product Vendors link that that premium extension added.

2

WooCommerce settings with product tab

To change this "sub navigation" you could use the WooCommerce filter "woocommerce_get_sections_products".

The following example code will remove the sub navigation point "inventory":

function change_navi_function($sections)
{
    // remove sub navigation point "inventory"
    unset($sections['inventory']);

    return $sections;
}

add_filter('woocommerce_get_sections_products', 'change_navi_function');

WooCommerce settings with product tab without the subnavigation point inventory

What you have to do now is either to hook your "change_navi_function" function after the function from the premium plugin and then remove the "Product Vendors" from the "$sections" array. Or you unhook the function from the premium plugin which use the "woocommerce_get_sections_products" filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.