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 ?
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
Great Ismael,
However I am looking for a possibility to do this for individual product pages.
Regards
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