In this article, we will explore different methods to remove related products in WooCommerce, providing you with step-by-step instructions. Related products are often displayed on WooCommerce product pages, but there are instances where you may want to remove them. Whether you want to streamline the product page layout, improve loading times, or create a more personalized shopping experience, we’ve got you covered. We will discuss various approaches and provide code snippets with highlights for each method to help you remove related products effectively.
Table of Contents
Methods to Remove Related Products
There are several ways to remove related products in WooCommerce. Here, we will outline three commonly used methods:
Method 1: Custom CSS
Custom CSS allows you to hide the related products section using code. Follow these steps:
- Go to your WordPress dashboard and navigate to “Appearance” > “Customize.“
- Click on “Additional CSS” or “Custom CSS” to access the CSS editor.
- Add the following CSS code snippet to hide the related products section:
/* Remove related products */
.up-sells, .related {
display: none;
}
4. Save the changes, and the related products section will be hidden on your WooCommerce product pages.
Method 2: functions.php Custom Code
For users comfortable with editing code, this method offers more control. Follow these steps:
- Open your theme’s “functions.php” file.
- Add the following code snippet to the file:
// Remove related products
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
- Save the changes, and the related products section will be removed from your WooCommerce product pages.
Conclusion
Removing related products in WooCommerce is a straightforward process that can be accomplished using different methods. Whether you prefer using a custom CSS, or editing code in the functions.php file, the choice depends on your technical expertise and specific requirements. By following the step-by-step instructions and utilizing the provided code snippets highlighted in this article, you can easily remove the related products section and customize the appearance and functionality of your WooCommerce product pages. Experiment with different approaches and find the method that best suits your needs.
I hope this article helped you to learn how to remove the related products in Woocommerce. If you have any doubts or problem with the code, comment below to find the solutions. Also share this blog if you find this useful.
Want to build professional website for your Business or Store, Get a free quote here
Click here to get Premium Plugins and Themes at rs.249. Get 20% Off on your first order “WELCOME20”