wc_products_array_filter_visible_grouped method

This commit is contained in:
Mike Jolley 2017-06-20 15:00:58 +01:00
parent 55ca1899ad
commit ae0e03ef53
1 changed files with 11 additions and 0 deletions

View File

@ -1033,6 +1033,17 @@ function wc_products_array_filter_visible( $product ) {
return $product && is_a( $product, 'WC_Product' ) && $product->is_visible();
}
/**
* Callback for array filter to get visible grouped products only.
*
* @since 3.1.0
* @param WC_Product $product
* @return bool
*/
function wc_products_array_filter_visible_grouped( $product ) {
return $product && is_a( $product, 'WC_Product' ) && ( 'publish' === $product->get_status() || current_user_can( 'edit_product', $product->get_id() ) );
}
/**
* Callback for array filter to get products the user can edit only.
*