function woocommerce_output_related_products() {
$args = array(
\'posts_per_page\' => 4,
\'columns\' => 4,
\'orderby\'
Use the woocommerce_related_products
filter hook instead, this way:
add_filter( 'woocommerce_related_products', 'exclude_related_products', 10, 3 );
function exclude_related_products( $related_posts, $product_id, $args ){
// HERE set your product IDs to exclude
$exclude_ids = array('502','281');
return array_diff( $related_posts, $exclude_ids );
}
Code goes in function.php file of your active child theme (or active theme). Tested and works.