Created
August 12, 2016 21:50
-
-
Save musamamasood/f224d2a0b9d60d5fe042e471c611d80f to your computer and use it in GitHub Desktop.
WooCommerce - Only show grouped products parent at Shop page.
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
//The idea is that we're modifying the query such that it will only show top-level items.... thus (in theory) nothing that has been assigned to a group, which would then have the group product's ID as the post_parent. | |
add_action( 'woocommerce_product_query', 'musamam_product_query' ); | |
function musamam_product_query( $q ){ | |
$q->set( 'post_parent', 0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment