How To Remove Related Products from WooCommerce

The code snippet below will allow you to remove related products from your WooCommerce store, in case you had everything in your store setup just right, and you didn’t want to feature cross sells in your site.

Cross sells and upsells

Its worth first understanding which related products are being displayed in your site (the code for which we won’t go into here) – so when testing, you should try adding a “cross sell” and an “up sell” to a product in your site, and seeing where these are displayed by your theme.

Where these are placed in your WooCommerce theme are really down to which theme you are using, though the description below will work on themes like WordPress Twenty Seventeen (i.e. the default wp theme!), or the WooCommerce Storefront theme to remove your site’s related products section.

Remove Related Products from WooCommerce

Add the below code to your theme’s functions.php file. This is best done in a child theme so your updates don’t get overwritten if you upgrade your theme.

This will remove them – not just hide them – from being called at all. Be aware that using a CSS hack like display:none; still calls the PHP and therefore adds load to your store, to pull in products you are hiding. This is slow and therefore sub-optimal. Use the code below to prevent the query from happening and keep the speed going too!

// place this in your child theme functions.php file to remove related products from WooCommerce
// posted by Robin Scott of Silicon Dales, here:
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
view raw functions.php hosted with ❤ by GitHub

Leave a comment below if this worked / didn’t work for you!

Get help and support with your WooCommerce store

If the above didn’t work for you, or you have other questions, and would to have accredited WooCommerce developers to check over your Woo store, please contact us. If you’re in Australia, our Australian WooCommerce support team can help.

3 thoughts on “How To Remove Related Products from WooCommerce

  1. this didnt work for me

    1. Hi MJ,

      Thanks for leaving a comment. I’ve updated this Gist in the above post to reflect the most recent version of WooCommerce. Now you’ll find this should get it done.

      If you use the Storefront theme, you can also try a couple of plugins for this, too, then the option to remove this should be in Customizer, the Storefront Powerpack plugin will do it for Storefront:

  2. Thanks. It worked.

Leave a Reply

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