Merge pull request #14685 from woocommerce/fix/14592
Filter invalid products before returning them for wc_get_products
This commit is contained in:
commit
10880ab680
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue