Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Fix filtering by product type on Store API (#4422)
Browse files Browse the repository at this point in the history
* Fixed $tax_query being set to an empty array

* Remove whitespace causing PHP coding standards test to fail

* Cleanup: add line break

Co-authored-by: Michael P. Pfeiffer <frontdevde@users.noreply.github.com>
  • Loading branch information
VoHoTv and frontdevde committed Jul 5, 2021
1 parent 69bea61 commit a855ebc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/StoreApi/Utilities/ProductQuery.php
Expand Up @@ -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'] ) {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit a855ebc

Please sign in to comment.