WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Remove breadcrumb from shop 'homepage' (32 posts)

  1. rikardo85
    Member
    Posted 1 year ago #

    Hello,

    I am looking for a way to remove the breadcrumb from the shop 'homepage'.

    I would like to keep the breadcrumb on all other pages.

    Thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. royho
    Member
    Posted 1 year ago #

    You can use something like this in your functions.php

    [ Moderator note: pre works but please use the backtick or code button for code snippets. ]

    if ( is_home() ) {
         remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }
  3. hueyapan
    Member
    Posted 1 year ago #

    I used this in the custom.css file in my theme. Worked like a charm:

    .home .breadcrumb {
        display: none;
    }
  4. GirlOrangeCoat
    Member
    Posted 1 year ago #

    Did this issue get resolved?

    I tried both of these options, and followed this page
    http://wcdocs.woothemes.com/codex/template-structure/

    and I still have breadcrumbs in my shop.

  5. GirlOrangeCoat
    Member
    Posted 1 year ago #

    The above suggestions didn't work but I ended up finding this one and it worked like a gem!

    In woocommerce-config\config.php delete following code line:
    echo avia_breadcrumbs();

  6. royho
    Member
    Posted 1 year ago #

    It didn't work because your theme has its own breadcrumb namely avia_breadcrumb...

  7. helgatheviking
    Member
    Posted 1 year ago #

    @royho's suggestion is close for removing the woo breadcrumbs. i believe you just need to wrap that in a function and fire it on a hook. i usually remove things via the init or wp_head hooks

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

    but as royho mentioned, this is irrelevant if your theme is serving its own breadcrumbs. in which case, you'll need to dig into your themes and see if you can unhook them in a similar fashion.

  8. royho
    Member
    Posted 1 year ago #

    Actually you don't need to wrap that in a function. It is already being called..Because WooCommerce will fire off breadcrumbs within the callback of "woocommcerce_before_main_content". So that remove line removes that function from being called.

    You can test this by putting it directly in your functions.php and it will work.

  9. helgatheviking
    Member
    Posted 1 year ago #

    good to know. i've always wrapped it in a function b/c i thought that remove_action wasn't triggered the same way. thanks for the tip.

  10. James
    Member
    Posted 1 year ago #

    Thanks hueyapan, that little bit of css did the trick nice and easy for me, saved me wading through the code myself! :)

  11. lmoore11608
    Member
    Posted 1 year ago #

    What worked?

  12. emielm
    Member
    Posted 1 year ago #

    None of the solution above is working for me. I want to delete all woocommerce breadcrumbs from every page (like lmoore i am using yoast's). With the above solution I can't get it even from one page. I tried this too:

    if ( is_page('shop') ) {
         remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }

    Also doesn't work. Anyone having a working solution for this problem?

    Thanks in advance!

  13. RyanWheaton
    Member
    Posted 1 year ago #

    If you want to remove the breadcrumbs for specific pages, you can also do this in CSS. @Hueyapan was close. In WP, each page has its own body class(es). You can target the breadcrumbs on that specific page like:

    body .post-type-archive-product .breadcrumbs{ display:none; }

    You can just inspect the page in the browser, there will be a lot of classes for the body, but you should be able to find and narrow down a good selector

  14. Roy Ho
    Member
    Posted 1 year ago #

    @RyanWheaton - sorry but that is poor advice...hiding elements with CSS none is just bad practice. You should never do that unless you have no other choice.

  15. James
    Member
    Posted 1 year ago #

    I found this which seems to work for me to remove the WooCommerce breadcrumbs on every shop page:

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

    I added this to my themes custom functions.php file.

  16. emielm
    Member
    Posted 1 year ago #

    Hey splashingpixels,

    You have been commenting on several threads about these breadcrumbs that hiding them by using CSS none is not a good option, so that's clear. But can you also provide an alternative?

    I tried adding this code in my theme's functions.php, header.php (where perfectly working Yoast breadcrumbs code is in) and woocommerce files breadcrumbs.php and several other WC files:

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

    This all didn't prevent the WC breadcrumbs from showing up on all shop pages. Do you know where to add this piece of code then?

    Thanks for your reply in advance!

  17. Roy Ho
    Member
    Posted 1 year ago #

    @emielm - did you not see my reply? I am the first one who answer the OP with an solution in CODE. And the OP didn't state they were using Yoast breadcrumb. They're using default WooCommerce breadcrumbs. Not sure if that has anything to do with your issue.

  18. emielm
    Member
    Posted 1 year ago #

    @splashingpixels - That solution wasn't working for me, but I figured out why in the meantime. The solution code you offered in the first reply is working indeed, but in my case it had to be placed in header.php (themefile) instead of functions.php. As told I tried that before, but entered it outside an if-statement where is had to be inside, so that's why it wasn't working.

    Conclusion:
    remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0)

    is working fine, but you might have to insert it in another file then functions.php (and properly insert it of course ;-) )

  19. Roy Ho
    Member
    Posted 1 year ago #

    @emielm - it didn't work for you because you're not asking the same question as OP is. He wants to remove the DEFAULT breadcrumb from only the homepage. My code does exactly that. You on the other hand seem to want to remove the default breadcrumb completely so you can replace it with Yoast's breadcrumb...So I am not sure why you would say my solution is not working when it is not related to your question?

  20. emielm
    Member
    Posted 1 year ago #

    "You on the other hand seem to want to remove the default breadcrumb completely so you can replace it with Yoast's breadcrumb..."
    That's why I used your code without 'if ( is_home() )' statement. Yoast breadcrumb has nothing to do with it, these work perfectly on our site, as I told before. Your code except the if statement wasn't working in functions.php, but it DID WORK in header.php, that's all I said in my last post before this one to help others having this issue too. So thanks again for your piece of code, we are very happy with it.

  21. Roy Ho
    Member
    Posted 1 year ago #

    @emielm - if possible don't put that in the header.php as it doesn't belong there. It should work in functions.php. I urge you to test it again.

  22. James
    Member
    Posted 1 year ago #

    I eventually found the solution for removing the default breadcrumbs (from ALL pages though, not just the home one as the OP requested) and replacing them with the Yoast WP SEO ones instead - see this thread for details:
    http://wordpress.org/support/topic/replacing-woocommerce-breadcrumbs-with-yoast-seo-ones

    James :)

  23. jonnycuest
    Member
    Posted 1 year ago #

    Hello,

    I am using a php based template called Pindol from themeforest.net or muffingroup.com.

    I am trying to remove the breadcrumbs. I have had some bad luck editing the php as I am such a newbie with php that I am scared to mess with it and can't find any of the code mentioned above. I am looking for a Custom CSS solution. None of the previously suggested Custom CSS options have worked for me. Can anyone take a look at that template code and let me know specifically what I can do to get rid of these without breaking my template?

    I really appreciate any feedback.

    Thanks!
    John

  24. rconserta
    Member
    Posted 1 year ago #

    To change hueyapan's solution up a little. I noticed in my wootheme that the breadcrumbs style was calling #breadcrumbs and not .breadcrumbs so I used:

    .home #breadcrumbs {
        display: none;
    }

    And it worked.

  25. Bavaaz
    Member
    Posted 1 year ago #

    @rconserta,

    Thanks for sharing, it really worked!

  26. Raymond Lopez Aleman
    Member
    Posted 1 year ago #

    This worked best for me:

    add_action('template_redirect', 'remove_shop_breadcrumbs' );
    function remove_shop_breadcrumbs(){
    
    	if (is_shop())
    		remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    
    }
  27. fantasticmedia
    Member
    Posted 11 months ago #

    So whats the best code to use if you want to remove Woo Commerce default breadcrumbs from all shop pages?

  28. Roy Ho
    Member
    Posted 11 months ago #

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

    In your theme's functions.php

  29. oblivius
    Member
    Posted 11 months ago #

    sorry, but NOPE ! not in my "superstore" theme..Weird..TRIED ALL sugs in various files with zeroooo desired results.the ONLY thing that words is "display: none;" in css..last resort...yep

  30. lokgp
    Member
    Posted 11 months ago #

    This is a method to hide the breadcrumbs by adding this code to custom.css :

    .home #breadcrumbs {
        display: none;
    }

    This is not recommended. What it does is just hide the text. But the breadcrumbs are still executed, so you still get a huge blank empty space gap which represented the breadcrumbs. It is not good enough. Editing the functions.php as described below is preferred.

    Okay, I am made to understand that if you want to remove breadcrumbs, ONLY from your homepage add one of this to your functions.php:

    Option 1: If you are using a default homepage, use this:

    if ( is_home() ) {
         remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }

    Option 2: If you are using a static page , use this:

    if ( is_front_page() ) {
         remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
    }

    I am using a static page. I tried the code above, but it doesn't work.
    It is supposed to work, according to all WordPress help documents, it is supposed to return "true" that it is a static page and then execute the remove breadcrumbs. But it doesn't work. The static page I used has no title, as this was done to prevent getting 2 Home button on the Top Menu. I tried a different static page with a title, but it still didn't work.

    So, any better tricks?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic