Looking to remove related products and upsells in your WooCommerce store? All you may need is to remove two actions using your WordPress theme’s functions.php file.
1 answers
1
Through your functions file
Remove related products
For removing related products in WooCommerce, you simply need to remove the woocommerce_output_related_products action from the woocommerce_after_single_product_summary hook, as per the example below.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
A breakdown of the code above:
- woocommerce_after_single_product_summary is the WooCommerce hook (found in content-single-product.php).
- woocommerce_output_related_products is the hooked action.
- 20 is the location/order of which this action is hooked by.
Remove upsells
To remove product upsells in WooCommerce, you need to remove the woocommerce_upsell_display action from the woocommerce_after_single_product_summary hook, as per the below example.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
A breakdown of the code above:
- woocommerce_after_single_product_summary is the WooCommerce hook (found in content-single-product.php).
- woocommerce_upsell_display is the hooked action.
- 15 is the location/order of which this action is hooked by.
— Support WizardAnswer 1