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

Fix filtering by product type on Store API #4422

Merged
merged 3 commits into from Jul 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
frontdevde marked this conversation as resolved.
Show resolved Hide resolved
$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