Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1319661

    Hi,

    I found this code online to hide related products on individual productspage (Check Private Content).
    It works partly, it does not hide the related products yet.
    I think because of the worng naming of bbloomer_add_related_checkbox_products

    Maybe someone a tip ?

    #1319829

    Hey badoes,

    Thank you for the inquiry,

    The code above does not work because it is supposed to remove the default related products section or disable the function that does, but the theme has its own function for it. To disable that particular function, you can add this snippet in the functions.php.

    add_action("after_setup_theme", function() {
         remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_related_products', 20);
    }, 10); 
    

    Best regards,
    Ismael

    #1319841

    Great Ismael,

    However I am looking for a possibility to do this for individual product pages.

    Regards

    #1320068

    Hi,

    Thank you for the update.

    You can use conditional functions within the hook to limit the changes to the specified products.

    // https://developer.wordpress.org/reference/functions/is_single/

    Example:

    if(is_single(1234)) {
       // remove the related section
    }
    

    This will remove the related section in the product page with the ID 1234.

    Best regards,
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.