Home » WooCommerce: Hide Related Products @ Single Product Page

WooCommerce: Hide Related Products @ Single Product Page

by Tutor Aspire

Adding content to the WooCommerce Single Product Page is super easy – but what if you wish to remove / hide a default element?

Well, in this case it gets even easier. All you need to know is the default hook used by WooCommerce – so that you can remove it with one line of PHP in your functions.php. You can find a list of default hooks here: (https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/)

For example, how do we hide the Related Products? Well, here’s one line of code that will help you!

WooCommerce: Hide Related Products

PHP Snippet: Hide Related Products @ WooCommerce Single Product Page

/**
 * @snippet       Hide Related Products @ WooCommerce Single Product Page
 * @how-to        Get tutoraspire.com FREE
 * @source        https://tutoraspire.com/?p=72966
 * @author        Tutor Aspire
 * @testedwith    Woo 3.3.4
 */

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

It’s that simple, yes 🙂

You may also like