How to Remove Related Products WooCommerce ( 5 Ways )

Woocommerce is a powerful eCommerce platform with a lot of features that allow you to create your own custom shop and sell products online. However, even with all these features, WooCommerce is still limited in some ways. For example, you can’t remove related products directly from WooCommerce.

So if you are looking for a way to remove related products from your WooCommerce website, look no further, in this tutorial we have described several methods to remove them from your WordPress WooCommerce website. You may select one that is more suitable for you to follow.

Before you figure out how to remove or hide related products from your WooCommerce website, you should know what they are and why they should be removed from your site.

What are Related Products in WooCommerce?

Related Products in WooCommerce

Related products are products that are connected to one another in some way or you can say related products are other similar items suggested for purchase alongside the main product. You can use related products to create a sense of completeness for your customers and make your store appear more premium. In addition, related products allow you to diversify your product offering.

WooCommerce has built-in support for related products so you can easily create related product collections. For example, if you’re selling shirts, related products may be shirts in other colors, shirts with different styles, or shirts in different sizes. Related products are also known as cross-sell products or upsell products.

Because of this flexibility, your customers may buy related products that satisfy their needs. In addition to generating more sales, related products allow you to provide more choices to your customers.

For example, if you sell a product that helps people lose weight, you might also offer related products such as diet books or exercise equipment. Providing related products gives your customers additional ways to meet their goals. It also gives them more reasons to come back to your store later.

Why related products are shown in WooCommerce?

Related products are shown in WooCommerce to help customers find other products they might be interested in. By showing related products, customers can easily discover new products that they might want to buy.

There are a few different factors that WooCommerce uses to determine which products to show as related products. First, WooCommerce looks at the products that have been purchased together in the past. If two products are often purchased together, then they are more likely to be shown as related products.

WooCommerce also looks at the products that are in the same category or have the same tags. This helps to show products that are similar to each other and that customers might be interested in.

Also read: How to Remove Additional Information tab in WooCommerce

Why to remove Related Products from WooCommerce?

As I said WooCommerce is a popular eCommerce platform for many reasons, one of the key features is its ability to show related products to customers on the product page. This encourages customers to buy more products from your store, which is beneficial for store owners.

However, different store owners might have different perceptions regarding showing related products. For example, if a customer is looking for a pair of blue jeans in a store, then showing related products: like the same dress in different colors could be confusing to them. This could lead to no sale if the customer is confused about which product to buy.

In the end, it is entirely up to you to decide whether or not to display related products on your WooCommerce store. If you believe that showing related products will assist your customers in finding additional items they are interested in, then it is worth considering. On the other hand, if you think that it will confuse your customers, then you may want to remove it.

So, if you have decided to hide related products from your site, we come up with a list of ways through which you can easily disable this related product feature on your website.

5 Ways to remove Related Products from WooCommerce

In this article, I will be showing you five ways to get rid of related products in WooCommerce. However, the fundamental approach will be to remove them using code. Additionally, we will look at how to remove them using plugins.

1) Remove related products from WooCommerce With PHP code:

To disable WooCommerce related products from being displayed on your WooCommerce store pages, you may use PHP code. To do so, open your WordPress Dashboard > Appearance and then click on Theme Editor, then in the theme files look for the function.php file. Now at the bottom of your code, add the below PHP code snippet:

remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );

After the above code has been applied, you will no longer see related products on your WooCommerce store’s pages. If the above PHP code didn’t worked for you then you can use this below alternate code which also removes the related products section.

add_filter('woocommerce_product_related_posts_query', '__return_empty_array', 100);

Note: You should always make a backup of your website before editing code files because a single mistake in your code may cause major damage.

It’s important to note that when you modify your WordPress theme, previous theme files are deleted, and new ones are created. Although the code you added will be removed if you change your theme in the future, so what should you do now? Well, don’t worry I have a fix for this as well.

Remove related products from WooCommerce through Code Snippet Plugin

Code Snippet plugin

In order to keep your custom code from being removed when you change your theme in future, install the Code Snippet plugin. After installing, head over to Snippets in your dashboard, then click on add new, there assign a title to your custom code and paste the above code there and then click on Save changes and Activate button at the bottom of the page.

How to Remove Related Products WooCommerce ( 5 Ways )

2) Remove related products from WooCommerce With CSS code:

You can also use CSS code to hide the related products section on your WooCommerce pages. This is the easiest way to eliminate the related items tab on your pages. To accomplish this, log into your WordPress Dashboard > Appearance > Customizer and look for ‘Additional CSS Code’ at the bottom.

Additional CSS tab in Customization

Once the additional CSS tab is opened paste the following code there:

.related.products {
display: none;
}

Now, click on publish to update the changes and you will see that the related products section will be gone from your Woccommerce pages.

Despite how simple it is, this method is only for non-tech savvy WordPress developers and users. I would not recommend this approach to those who are familiar with adding PHP code, as it only hides related products and still runs in the background, and consumes web resources, which is not good for the SEO of your website.

You may like to read:

How to Fix Add to cart Button not Working WooCommerce

How to Change WooCommerce Button Color ( 3 Easy Ways )

How to Change WooCommerce Add to Cart Button Text

3) Remove related products from WooCommerce With Plugin:

If you are a WordPress amateur and don’t want to use code either PHP or CSS, and want to remove related products with the help of the plugin, then there is also a plugin available for it. The name of the plugin is NS Remove Related Products for WooCommerce. This plugin is free of cost and easy to use.

NS remove related products for WooCommerce

Once you’ve installed and activated this plugin, go to your WordPress Dashboard and click on Remove Related in the sidebar to see all of the options available. There, you can hide related products or even can change the number of related products displayed.

Is it possible to display related products on all other shop products but disable it for specific items/products? Well, the answer is Yes, you can disable related products on specific products or individuals.

4) Remove Related Products only on Specific Products

You can specifically hide the related products section on an individual product so that users won’t see related items for that particular product. To do so, copy the below code and paste it either in function.php file or in the code snippet plugin which I have mentioned above.

// 1. Adding a checkbox to the product page to remove related products
add_action( 'woocommerce_product_options_general_product_data', 'webtalkhub_add_related_products_checkbox' ); 
function webtalkhub_add_related_products_checkbox() 
{woocommerce_wp_checkbox( array(
   'id' => 'hide_related',
   'class' => '',
   'label' => 'Remove related products'
)
);
}
// 2. Save checkbox field

add_action( 'save_post_product', 'webtalkhub_save_related_products_checkbox' );
function webtalkhub_save_related_products_checkbox( $product_id ) {
global $pagenow, $typenow;
if ( 'post.php' !== $pagenow || 'product' !== $typenow ) return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( isset( $_POST['hide_related'] ) ) {
update_post_meta( $product_id, 'hide_related', $_POST['hide_related'] );
} else delete_post_meta( $product_id, 'hide_related' );
}

// 3. Hide related products in single product page

add_action( 'woocommerce_after_single_product_summary', 'webtalkhub_hide_related_products_checkbox', 1 );
function webtalkhub_hide_related_products_checkbox() {
global $product;
if ( ! empty ( get_post_meta( $product->get_id(), 'hide_related', true ) ) ) {
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
}
}

In your WooCommerce products tab (where you edit products ), a new checkbox feature will appear in General tab, after you add this code to your website. If the checkbox is checked on any product, the related products section will not show up on that particular item.

Checkbox to remove related products from WooCommerce

In this way, you can show related items on all other items, except for some particular items on which you do not want to show the related products area.

5) Change the Number of related products from WooCommerce :

If you don’t want to remove related products from your WooCommerce page and just want to decrease the number of products displayed, then use the code below to increase or decrease the numbers:

/**
* Change the number of related products
*/ 
function woo_related_products_limit() {
global $product;
$args['posts_per_page'] = 6;
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'webtalkhub_related_products_args', 20 );
function webtalkhub_related_products_args( $args ) {
$args['posts_per_page'] = 3; // restricted to 3 related products
$args['columns'] = 3; // arranged in 3 columns, you can set to any number of columns
return $args;
}

This code will restrict the related products to three, you can decrease or increase this number by changing it to any number you want.

Changing or Adding Related Product Items in WooCommerce Product Pages

WordPress does not have a built-in feature to customize related product items, however, I come up with a way through which you can easily customize related product items.

To accomplish this you have to first follow our fourth method in which related products can be removed individually on a specific product, after disabling it go to your Dashboard > All Products > Edit that particular product, there you will see Linked Products.

Linked Products in WooCommerce

Open this tab, and there linked up your products which you want to be shown as related products. This way the WooCommerce default-related products will get hidden and your own custom-related products will start displaying on that particular product.

You might be wondering why I used the fourth method to disable the default WooCommerce-related product items. Well, because if you use any other method, the related products will get hidden from all other products and you don’t want that, as you are changing related items for only that specific product.

Pros and Cons of using Related Products in Your Shop Pages

ProsCons
Related products are shown in WooCommerce to help customers find other products they might be interested in.Related Products might be confusing for customers when they are too similar. This can lead to no sale because the customer will do further research to buy that product and end up leaving your site.
Related products can generate more sales, provide more choices to customers and help with customer satisfaction.

For example:
On an e-commerce website when a user is about to buy an Apple iPad and sees other related accessories to that iPad like Apple pencil, smart case or Apple magic keyboard etc.

So they may want to buy them and will also order them.
In worst case, related products can also decrease your sales as customer might be confused in choosing the better product

For example:
I will give you my personal example I opened a website to buy Ipad mini 6 2022 model, In the related products there was Ipad Air 2022.

I did research and checked the specs of both Ipads. In the end I decided to buy Ipad Air 2022 because it was having good specs, but its price was higher so I decided not to buy right now but will check this out later when I have the budget available for it

FAQ( How to Remove Related Products WooCommerce )

How do I remove related products from the product page?

In the function.php of your theme files, add the following code to remove related products from the products page:

remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 );

How do I Add related products in WooCommerce?

To add related products in WooCommerce pages, go to your Dashboard > WooCommerce > Product, and click on it to edit. You’ll see a Linked Products tab, open it and add your own related products.

Where do Related Products come from in WooCommerce?

In WooCommerce, if other products are in the same category or have the same tags as the main product, they might show up as related products, WooCommerce also looks at products that are often purchased together to determine if they are considered related products.

How to Remove Related Products with Plugin

NS Remove Related Products for WooCommerce is the plugin through which you can easily remove related products, Install and activate this plugin then on your WordPress Dashboard, head over to this plugin setting where you can disable it.

Conclusion

Through the five simple ways described in this article, you’ll learn how to remove related products from your WooCommerce pages. You can also learn how to reduce the number of items displayed in the related products section if you don’t want to remove them and just to decrease the items.

Furthermore, I demonstrated how to add your own custom related products to WooCommerce if you do not like the default ones.I hope you learned a lot from this guide and obtained what you wanted for your website.

Thats it for this topic, for any queries related to this topic, please leave a comment below and I will get back to you as soon as possible.Please also let us know on our contact page if you want us to write articles about other WordPress topics. Thank you!

Hamza Afridi is a Full stack Web & WordPress developer and writer with 5+ years of experience. He is Founder of webtalkhub.com, a blog on web development, SEO, and digital marketing tutorials. He enjoys learning and sharing new technologies.

Leave a Comment