Website Building » WooCommerce » How Do I Remove Related Products in WooCommerce?

How Do I Remove Related Products in WooCommerce?

Last updated on October 1, 2022 @ 3:47 pm

Related products are a great way to cross-sell and upsell products in your WooCommerce store. They can be displayed on product pages, cart pages, and checkout pages.

However, there may be times when you want to remove related products from your store.

There are a few different ways to remove related products from your WooCommerce store. The first way is to disable related products altogether. You can do this by going to WooCommerce > Settings > Products and deselecting the checkbox for “Enable related products”.

If you only want to remove related products from certain pages, you can use the following code snippets:

To remove related products from the product page:

add_action( ‘wp’, ‘woo_remove_related_products’, 20 );

function woo_remove_related_products() {

if ( is_product() ) {

remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 );

}}

To remove related products from the cart page:

add_action( ‘wp’, ‘woo_remove_related_products’, 20 );

function woo_remove_related_products() {

if ( is_cart() ) {

remove_action( ‘woocommerce_after_cart’, ‘woocommerce_ output _related _products ‘, 10 );

< p > < b > To remove related products from the checkout page: < /b > < / p > < p > < u > add _ action ( ‘wp’ , ‘woo _ remove _ related _ products’ , 20 ) ; < / u > < / p > function woo _ remove _ related _ products ( ) { if ( is _ checkout ( ) ) { remove _ action ( ‘WooCommerce _ after _ order _ review’ , ‘WooCommerce output related products’ , 10 ) ; } }

Related products can be a great way to increase sales on your WooCommerce store. However, there may be times when you want to remove them. You can disable related products altogether or remove them from certain pages using code snippets.

PRO TIP: Please be aware that removing related products in WooCommerce may adversely affect your website’s performance. Use this feature with caution and always backup your data before making any changes.
Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.