How To Remove Related Products Woocommerce

As a passionate Woocommerce user, I sympathize with the challenges of removing related products from your e-commerce site. By default, Woocommerce includes a feature that showcases related products on your product pages, often causing clutter and hindering customers from completing a purchase. This article aims to assist you in removing related products in Woocommerce, offering detailed instructions and my personal insights.

Step 1: Accessing the Functions.php File

The first step is to access the functions.php file of your WordPress theme. This file contains the code that controls the functionality of your website. To access the functions.php file, follow these steps:

  1. Login to your WordPress dashboard
  2. Navigate to “Appearance” and click on “Theme Editor”
  3. On the right-hand side, find and click on “Theme Functions”
  4. The functions.php file will open in the code editor.

Step 2: Finding the Correct Hook

Now that you have the functions.php file open, the next step is to find the correct hook where you can add your code to remove the related products. The hook we’ll be using is the “woocommerce_after_single_product_summary” hook, which allows us to modify the product page after the product summary section. Here’s how you can find and add the hook:

  1. Using the search function in the code editor, search for “woocommerce_after_single_product_summary”.
  2. You should find a line of code that looks like this: do_action( 'woocommerce_after_single_product_summary' );
  3. Directly below this line, add the following code:


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

Step 3: Updating the Functions.php File

After adding the code to remove the related products, it’s important to save the changes you made to the functions.php file. To do this, click on the “Update File” button located at the bottom of the code editor.

Step 4: Testing the Results

Now that you’ve removed the related products code, it’s time to test the results. Open a product page on your WooCommerce store and check if the related products section is no longer visible. If the related products section is no longer displayed, congratulations! You have successfully removed the related products from WooCommerce.

Pro Tip: Using a Child Theme

When making changes to your theme’s functions.php file, it’s always a good idea to use a child theme. A child theme allows you to make modifications to the theme without affecting the original theme files. This way, you can easily update the parent theme without losing your customizations. If you are not using a child theme, consider creating one before making any changes to the functions.php file.

Conclusion

Removing related products from WooCommerce can greatly improve the user experience on your online store. By following the steps outlined in this article, you can easily remove the related products section and create a cleaner product page for your customers. Remember to always make changes to your theme files with caution and consider using a child theme to avoid any potential issues. Happy WooCommerce customization!