Merge pull request #13844 from woocommerce/fix-13839

[REST API] Ignore 0 category while querying products
This commit is contained in:
Mike Jolley 2017-03-30 18:06:04 +01:00 committed by GitHub
commit 5d62d3c844
1 changed files with 4 additions and 0 deletions

View File

@ -151,6 +151,10 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller {
// Set tax_query for each passed arg.
foreach ( $taxonomies as $taxonomy => $key ) {
if ( ! empty( $request[ $key ] ) && is_array( $request[ $key ] ) ) {
$request[ $key ] = array_filter( $request[ $key ] );
}
if ( ! empty( $request[ $key ] ) ) {
$tax_query[] = array(
'taxonomy' => $taxonomy,