Tagged: enfold, Hooks, woocommerce
Hi,
I’ve setup Enfold with a child theme and all seems to be working fine. I can update CSS no problem in my styles.css child theme. I want to remove related products from woo commerce pages but nothing seems to work. I added this code to my child functions.php:
/* Disable Related products on single product pages */
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products',20);
No love there. As a test I tried it on the parent theme and still not love.
Just for fun (and to make sure I’m not crazy) I switched themes to twenty fourteen and that code works as expected.
I know the child theme functions.php is working cause (well no reason for it not to) I can add some incorrect PHP and break the site.
I tried over riding woocommerce templates by adding theme to my child theme and editing PHP but that doesn’t work.
I can hide it via CSS but that’s pretty crude.
Am I missing something? Is Enfold overriding my attempts?
Hey kevince52!
Try this out.
add_action( 'init', 'enfold_customization_remove_related_products' );
function enfold_customization_remove_related_products(){
remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_related_products', 20);
}
Because the child theme gets executed first we have to delay the remove_action until the parent theme adds it.
Best regards,
Elliott
Brilliant. That worked. Should have remembered the order. Thanks for your help. It will solve a few other issues I’m having. Great theme by the way.