Remove breadcrumbs from WooCommerce Storefront theme

Viewed 7395

In order to remove breadcrumbs from the Storefront theme, the documentation states to add the following in functions.php:

remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );

I tried this in a child theme of Storefront and it doesn't work. Tracing back the woocommerce_breadcrumb, it seems to be added in storefront_content_top action (in the file <storefront_dir>/inc/woocommerce/storefront-woocommerce-template-hooks.php. I commented out the corresponding line and indeed the breadcrumbs are hidden.

However, to do this the right way, I try to disable it from the child theme using

remove_action( 'storefront_content_top', 'woocommerce_breadcrumb', 10 );

but it doesn't work. I should clarify that I test this in a fresh child theme with no other code.

How would one disable the breadcrumbs from a child theme?

4 Answers

Copy and paste the following snippet into your functions.php file.

add_action( 'init', 'z_remove_wc_breadcrumbs');

function z_remove_wc_breadcrumbs() {
    remove_action( 'storefront_before_content', 'woocommerce_breadcrumb', 10);
}

since Storefront 2.3.1 try this

add_action('init', 'dp_remove_wc_breadcrumbs');

function dp_remove_wc_breadcrumbs(){
    remove_action('storefront_before_content', 'woocommerce_breadcrumb', 10);
};
Related