Merge pull request #14685 from woocommerce/fix/14592

Filter invalid products before returning them for wc_get_products
This commit is contained in:
Claudio Sanches 2017-04-25 12:45:17 -03:00 committed by GitHub
commit 10880ab680
1 changed files with 1 additions and 1 deletions

View File

@ -1238,7 +1238,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
$products = new WP_Query( $wp_query_args );
if ( 'objects' === $args['return'] ) {
$return = array_map( 'wc_get_product', $products->posts );
$return = array_filter( array_map( 'wc_get_product', $products->posts ) );
} else {
$return = $products->posts;
}