Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove breadcrumbs from WooCommerce Storefront theme

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?

like image 352
Demetris Avatar asked Jul 15 '17 12:07

Demetris


People also ask

How do I remove WooCommerce breadcrumbs?

After clicking that link, you will go to the panel of WordPress Customizer. In this section, choose “Layout”, and select “WooCommerce” before picking up “Single Product”. Here, you choose the checkbox “Disable Breadcrumb” and select the button “Publish”.

How do I get rid of breadcrumbs in WordPress theme?

In the customization screen, you may see Theme Options as shown in the following image. In other themes, breadcrumb options are located under the Header button. Press the Breadcrumb button to show options. Press the toggle button to disable breadcrumbs, then press the Publish button to apply changes.

How do I change breadcrumbs in WooCommerce?

All you have to do is head over to All in One SEO » General Settings and then select the Breadcrumbs tab. Next, scroll down to the 'Breadcrumbs Templates' section and select the Taxonomies tab. By default, the plugin will show the parent item link in the breadcrumb on your WooCommerce store.

How do I get rid of breadcrumbs?

There are several breadcrumb plugins, including "WordPress Breadcrumbs" and "Yoast Breadcrumbs." Most plugins have "Breadcrumbs" in the title. Click "Deactivate" beneath the plugin to remove the generated breadcrumbs. If you don't see a breadcrumb plugin, it may be automatically included with your theme.


3 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);
}
like image 154
Zihad Ul Islam Avatar answered Jan 06 '23 08:01

Zihad Ul Islam


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);
};
like image 37
encoder21 Avatar answered Jan 06 '23 07:01

encoder21


Try this:

add_filter( ‘woocommerce_get_breadcrumb’, ‘__return_false’ );
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0);
like image 43
wpcoder Avatar answered Jan 06 '23 08:01

wpcoder