diff --git a/src/StoreApi/Utilities/ProductQuery.php b/src/StoreApi/Utilities/ProductQuery.php index 89a87156ee5..efd2a6e9e31 100644 --- a/src/StoreApi/Utilities/ProductQuery.php +++ b/src/StoreApi/Utilities/ProductQuery.php @@ -41,6 +41,9 @@ public function prepare_objects_query( $request ) { $args['post_type'] = [ 'product', 'product_variation' ]; } + // Taxonomy query to filter products by type, category, tag, shipping class, and attribute. + $tax_query = []; + // Filter product type by slug. if ( ! empty( $request['type'] ) ) { if ( 'variation' === $request['type'] ) { @@ -88,9 +91,6 @@ public function prepare_objects_query( $request ) { } } - // Taxonomy query to filter products by type, category, tag, shipping class, and attribute. - $tax_query = []; - $operator_mapping = [ 'in' => 'IN', 'not_in' => 'NOT IN',