wordpress – woocomerce – remove breadcrumbs from shop landing page

I have wordpress with woocommerce. I am trying to stop the breadcrumbs displaying on the page that lists the categories which I have set as the ‘shop page’ in the wc settings.

The id of the page is ‘5’ and it has the name/slug ‘materials’

Read More

in my functions.php I have put

if (is_page('materials')){
    add_action( 'init', 'am_remove_wc_breadcrumbs' );
}
function am_remove_wc_breadcrumbs() {
    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}

i have changed the selector in the if statement to 5 – no joy either. If I remove the if statement around the add_action then the breadcrumbs are removed from all the pages – as you’d expect.

Related posts

1 comment

  1. Give a try with following:

    add_action('template_redirect', 'remove_page_breadcrumbs' );
    function remove_page_breadcrumbs(){
        if (is_page('YOUR_PAGE_ID_OR_SLUG'))
        remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }
    

Comments are closed.