In this snippet we’ll show you 2 different ways to remove related products on the WooCommerce single product page for all products.
To add this code to your WordPress website, you will either need to create a Child Theme yourself, or to add a small Site Customizations plugin where you can add any type of custom code.
Remove related products using php:
Simply add the following PHP to your child theme functions.php file and that will remove the related products section on all WooCommerce products.
// Remove WooCommerce Related Products on product single page
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
Remove related products using CSS
Another way to remove related products on the WooCommerce single product page is to use a little custom CSS. This method is recommended more as a backup for the php snippet and we recommend rather using the php snippet above.
body.single-product section.related.products {
display: none !important;
}
If you’re rather unfamiliar with adding custom code to your WordPress site and would prefer to easily remove the Related Products section by using visual settings in the WordPress Customizer, then try out our StoreCustomizer WooCommerce plugin.
Our StoreCustomizer plugin offers these code snippets all built into the WordPress Customizer to easily remove related products on your product pages in WooCommerce, the WooCustomizer plugin uses the php snippet as well as the custom CSS as a backup.