• Resolved mindphuk

    (@mindphuk)


    This is a very simple task and it’s impossible to solve without quirks. I have now walked through a whole google search page and tried different examples and none works.

    I just want to hide “related products” on the product page. No matter what, no selection on anything, just hide that block. Also no CSS tricks, it should just not be pulled from database and not displayed.

    Why is there not a setting in WC for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mindphuk

    (@mindphuk)

    add_action( ‘woocommerce_after_single_product_summary’, ‘remove_related_products_conditionally’, 1 );
    function remove_related_products_conditionally(){
    global $product;

    // HERE Define your targeted product Id(s) (in the array)
    $targeted_products = array( 37 );

    if( in_array( $product->get_id(), $targeted_products ) )
    remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 );
    }

    Next example I tried that doesnt work

    Hello,

    Please check out our documentation for disabling related products: https://docs.woocommerce.com/document/remove-related-posts-output/

    I hope it will point you in the right direction.

    Hi @mindphuk

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide related products doesnt work’ is closed to new replies.