Last active
April 6, 2017 15:23
-
-
Save growdev/4074021 to your computer and use it in GitHub Desktop.
WooCommerce - Remove the "Related Products" section from a template by removing the related posts query arguments.
This file contains hidden or 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 | |
/* | |
* wc_remove_related_products | |
* | |
* Clear the query arguments for related products so none show. | |
* Add this code to your theme functions.php file. | |
*/ | |
function wc_remove_related_products( $args ) { | |
return array(); | |
} | |
add_filter('woocommerce_related_products_args','wc_remove_related_products', 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In WooCommerce 3.0 this will not work.
Working code (assuming that you use the default WooCommerce template):