[Resolved] Hiding breadcrumbs on Shop page, but not other shop archives

Home Forums Support [Resolved] Hiding breadcrumbs on Shop page, but not other shop archives

Home Forums Support Hiding breadcrumbs on Shop page, but not other shop archives

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1571504
    Alexandra

    Hey guys,
    Is there a way to hide the breadcrumbs on my shop page but have them on all other product archives?
    My shop page: https://alex.bandiwork.dev/shop
    Example of another product archive: https://alex.bandiwork.dev/product-category/produse-imprimate/tote-bags

    Thank you!

    #1571557
    David
    Staff
    Customer Support

    Hi there,

    try adding this PHP snippet:

    add_action( 'init', 'woo_remove_wc_breadcrumbs' );
    function woo_remove_wc_breadcrumbs() {
        if (is_shop()) {
            remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
        }
    }
    #1572384
    Alexandra

    Hmm, it doesn’t seem to work… I added it but the breadcrumb still shows up on the Shop page ๐Ÿ™

    #1572526
    David
    Staff
    Customer Support

    Hmmm…

    If you try this:

    add_action( 'init', 'woo_remove_wc_breadcrumbs' );
    function woo_remove_wc_breadcrumbs() {
            remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
    }

    Does it remove the breadcrumb ? it should remove it from everywhere – just want to check if its the hook or the IF condition thats the problem.

    #1577161
    Alexandra

    Hi, David!
    Yes, this did remove the breadcrumb from everywhere.
    So it seems like it’s the IF condition that’s the problem…

    #1577476
    David
    Staff
    Customer Support

    Aah ok, try this:

    add_action( 'template_redirect', 'woo_remove_wc_breadcrumbs' );
    function woo_remove_wc_breadcrumbs() {
        if (is_shop()) {
            remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
        }
    }
    #1578309
    Alexandra

    That’s awesome!
    Thank you so much, David! ๐Ÿ™‚
    Worked perfectly!

    #1578454
    David
    Staff
    Customer Support

    Glad to be of help!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.