Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Theming Snippets] Remove related products output
@OnlineLogoMaker
Copy link

OnlineLogoMaker commented Mar 24, 2019

It's not working on my store. I add the code with Snippet but the related products still there.
URL sample: https://www.designfreelogoonline.com/logoshop/luxury-alphabet-logo-templates/

Kindly advice what can be done?
I don't want to hide it with CSS, I want to remove it completely.

@friendsfirstphoto
Copy link

friendsfirstphoto commented Jun 10, 2019

It's not working for me either and I did exactly as suggested.

@marcos-alexandre82
Copy link

marcos-alexandre82 commented Jun 20, 2019

The code that worked for me was:

add_filter('woocommerce_product_related_posts_query', '__return_empty_array', 100);

@OnlineLogoMaker
Copy link

OnlineLogoMaker commented Nov 19, 2019

Still not working for me, I am using Woocommerce 3.8.0 and Avada 6.1.1... anyone had the same problem?

@marcos-alexandre82
Copy link

marcos-alexandre82 commented Nov 19, 2019

I developed a plugin based on this filter:

https://wordpress.org/plugins/remove-woocommerce-product-related/

If you can test, thank you;)

Thanks!

@surya5353
Copy link

surya5353 commented Sep 16, 2020

Still not working for me, I am using Woocommerce 3.8.0 and Avada 6.1.1... anyone had the same problem?

function remove_woo_relate_products(){
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
//remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
}
add_action('init', 'remove_woo_relate_products', 10);

@maniac-0s
Copy link

maniac-0s commented May 28, 2021

None of these examples works. Why do I need a plugin for every basic thing in wordpress so annoying

@midweste
Copy link

midweste commented Oct 4, 2021

For those that had probems with this working, you need to wait until woocommerce is loaded before you can remove this action as this action has yet to be added until a point later in the process

add_action('woocommerce_loaded', function () { remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); }, PHP_INT_MAX);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment