WooCommerce: Remove Cross-Sells @ Cart Page

A client wanted to completely remove the area on the Cart page where “You may be interested in…” cross-sell products show.

This is helpful if business needs change at some time and you don’t want to manually remove cross-sells from each single product in your store by hand. Enjoy!

WooCommerce: remove cross-sells on the Cart page
WooCommerce: remove cross-sells on the Cart page

PHP Snippet: Remove Cross-Sells @ WooCommerce Cart Page

/**
 * @snippet       Hide Cross-sells @ Cart
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 6
 * @community     https://businessbloomer.com/club/
 */
  
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

43 thoughts on “WooCommerce: Remove Cross-Sells @ Cart Page

  1. I put the code in my functions.php but it does not work anymore.

    1. Thanks for your feedback! So it used to work? Are you able to pinpoint what happened on the site when it stopped working e.g. a third party plugin update?

  2. Hi Rodolfo,

    Love the code snippets you provide, I have used quite a few of them already!

    Just wondering if you would know how to HIDE certain products from the catalogue but, display them as cross sells at checkout ONLY.

    For example, products A,B & C are included in shops inventory but, only product A is displayed in shop’s catalogue. When product A is placed in basket, products B & C are displayed at checkout as cross sells.

    Thanks in advance

    1. Hi there thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  3. Hi Rodolfo,

    “I will create & install your child theme” link doesn’t work anymore. Goes to a 404.

  4. Thank you so much, now my cart page is seems clear without distraction

  5. Hi Rodolfo,
    Is it possible to replace the cross-sells with recently viewed?
    This would remove the hassle of setting up cross-sells and at the same time ensure customers on the cart page are only viewing something they’ve already shown interest in.
    Any suggestions on how this could be achieved would be very much appreciated 🙂
    Kind regards,
    JP

    1. Hey Jon-Paul, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  6. Thanks so much for the code. I have the Maxstore Pro Theme and it worked perfectly for me. I don’t mind having the cross sells on the product pages but to have it on the cart was forcing customers to scroll to much. They are at the check out page for a reason and i don’t want to distract them from clicking the “proceed to check out” button. This code you gave us is exactly what i needed!

    1. Awesome!

  7. Code still works Rodolfo. Running WooCommerce 3.6.2 and WP 5.2 on a Storefront theme.

    Thanks for this.

    1. Great!

  8. Hi Rodolfo, How can I hide product from shop but show it in cart as cross-sell. I need to unset other shipping methods than homedelivery if you choose pooltable installation and it seems to be fairly hard to do with woocommerce product addons. If I would make installation as products and only cross-sell those it would be easy to unsett shipping methods.

    1. I found a dirty way of doing it by creating a new category, excluding that category from shop
      then unset other shipping methods if that category is in cart and cross-sell it.

  9. Thanks for sharing… what a great resource this page is. I learned a lot. Any idea on how one can change the view of the cross-sells from list to grid? The rest of my site uses list, but it takes up way too much room on the cart page.
    Thanks for any insight you can offer

    1. Hello Randall, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  10. Hi,

    You seem like a nice guy! 🙂 Thanks for the snippet, but unfortunately it doesn’t work for me.
    I tried to put it on all places, and I also used the snippets you put in the comments but those doesn’t work either.

    I just want to have everything removed haha.

    Tom

    1. Hey Tom, thanks for your comment! It could be you’re using a custom theme and this default cross-sells code won’t work. Try for a second with a different theme and see if that works 🙂

  11. Hi Rodolfo,

    Thanks so much for all the great examples! One issue I have is that the above code does not remove the default instance of the cross sells. It does correctly add the new instance at the bottom of the page, but now I have two separate cross sell boxes on the cart page…not ideal.

    Any thoughts what I can do to remove the default one?

    I’ve tried a CSS solution, but that removes both instances.

    Thanks!

    1. Hey Nick, thanks for your comment! It could be that you need to call the remove_action later on (after it has been added) – or that your theme is overriding the cross-sells and therefore you need to tweak the code accordingly. Hope this helps 🙂

  12. Excellent – I recently migrated to WordPress/Wwoocommerce cart and this is one of the handful of little things that I needed to change. I thought it would be tricky but your blog made it simple and (best of all) it just worked first time. Nice tip!
    Cheers, Nick

    1. Brilliant, thank you Nick 🙂

  13. Hi, thanks for your article, I’m wondering how I can add a single cross sell to all my products without going through each product separately and changing them in the WordPress admin. Do you know of a way to do this in bulk?
    Thanks

    1. Hey CK, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here on the blog. Thanks a lot for your understanding! ~R

  14. Hello Rodolfo!
    My problem is my cart layout doesn’t look like yours on the picture. But i would like it to be just like it-right now my cross-sells are under ths hipping calculator so it is kinda not seen by anyone. I would like it to be next to the calculator either on the right or left side.
    Thanks,
    Daniel

    1. Hey Dani! Thanks for your comment 🙂 What theme are you using and can you also give us a link to your website? This would help! ~R

      1. Hey!
        https://www.dronkiraly.hu/ (test phase yet so dont be surprised:D)

        1. Thank you 🙂 I will need to take a look at the Enfold theme files in order to give you a PHP fix. For now, you can use this (not ideal, but it works):

          
          // Enfold Theme CSS to Remove Cart Cross-Sells
          
          .woocommerce-cart .cross-sells {
          display: none !important
          }
          
          
          1. I mean i don’t want it removed, i just want it to be near the shipping calculator and not below it.
            Thanks,
            Daniel

            1. Hey Dani, for this I will need the Enfold theme files or at least to access your Cart page (broken at the moment) 🙂

          2. Its good now. Yes, sure, i made you an account(emailed to bloomer mail) Thank you:)

            1. You’re trying to override cart.php there but it’s not necessary. You’ve probably broken a few things in the code as well 🙂 Remove the Cart.php override and then I’ll see what I can do 🙂

          3. Sure, did it 🙂

            1. Looks better 🙂 Here you go, you can do it via CSS, no need to use PHP:

              
              .cart-collaterals {
                  width: 50%;
                  float: right;
                  display: block;
              }
              
              .cart-collaterals .cart_totals {
              float:none;
              width: 100%
              }
              
              .cross-sells .cross-sells {
                  float: left;
                  width: 50%;
                  display: block;
                  padding-top: 0;
                  margin-top: 0;
                  border: 0;
              }
              
              
          4. O awesome, thanks alot man, you are great!!!:)

            1. 🙂 You’re welcome!

  15. Hi Rodolfo As I have only recently relaunched my website http://www.brownbinrescue.ie as mobile optimised and powered by Woo I will want to see as many of these trusted snippets you selflessly share with us all. My site has a Related Product route which I think is much better than the above presentation which yes would drive a customer mad.

    Thanks Rodolfo
    Denis.

    1. Thank you Denis for the feedback – much appreciated! I love when you say “trusted snippets you selflessly share with us all”, I was never given such a compliment! It may become my new tagline 🙂

  16. Thank you so much for sharing your knowledge with us! These snippets are very useful!!!

    1. And thank you so much for your comment 🙂 Keep’em coming!

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *