• 1102 Views
  • 0 comment
  • Print

As soon as you install “WooCommerce” plugin on your WordPress based site, it adds number of default features with the plugin activation. Apart from helping WordPress to become an eCommerce site, this plugin pushes further to become a full fledged eCommerce platform. Displaying related products on a single product page is one such feature which I think is a great addition to WooCommerce. Similar idea can be applied for blog posts as well. In fact, I wrote number of posts (based on taxonomy term, post author, categories) on this topic in the past.

While working on a project, recently one of my client requested me to remove the Related Products section altogether from the single product page. It really didn’t make any sense to me! why in the world someone would want to remove the related section?! I explained my logic why I think she should have it. Unfortunately, she decided to go without the related products list.

Here is the little snippet that might help you to get your job done if you want to remove them from single product’s page.

<?php
/** 
 * Remove Related Products List
 */
add_filter('woocommerce_related_products_args','remove_related_products', 10); 
function remove_related_products($args) {
	return array();
}
?>

Just like every other time, simply copy this snippet and paste it on your current theme’s functions.php page and update it. You are done.

Source: WooCommerce Codex