Created
December 5, 2017 05:36
-
-
Save Luminus/cad54c9afca38aab4f849458c15c0b7f to your computer and use it in GitHub Desktop.
Remove Related Products from the Single Product Page for Products in a Specific Category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp', 'vn_remove_related_products' ); | |
function vn_remove_related_products() { | |
// replace 'accessories' with the slug for your product category | |
if ( is_product() && has_term( 'accessories', 'product_cat' ) ) { | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks much for that snippet!