Instead of catching just the post_status, don't overwrite any filter args.
This commit is contained in:
parent
6cb9e1b613
commit
43e55c3336
|
@ -130,11 +130,7 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
|
||||||
*/
|
*/
|
||||||
public function query_args( $args, $request ) {
|
public function query_args( $args, $request ) {
|
||||||
// Set post_status.
|
// Set post_status.
|
||||||
if ( ! empty( $request['filter'] ) && ! empty( $request['filter']['post_status'] ) ) {
|
|
||||||
$args['post_status'] = $request['filter']['post_status'];
|
|
||||||
} else {
|
|
||||||
$args['post_status'] = $request['status'];
|
$args['post_status'] = $request['status'];
|
||||||
}
|
|
||||||
|
|
||||||
// Taxonomy query to filter products by type, category,
|
// Taxonomy query to filter products by type, category,
|
||||||
// tag, shipping class, and attribute.
|
// tag, shipping class, and attribute.
|
||||||
|
@ -203,6 +199,11 @@ class WC_REST_Products_Controller extends WC_REST_Posts_Controller {
|
||||||
$args['post_type'] = array( 'product', 'product_variation' );
|
$args['post_type'] = array( 'product', 'product_variation' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( is_array( $request['filter'] ) ) {
|
||||||
|
$args = array_merge( $args, $request['filter'] );
|
||||||
|
unset( $args['filter'] );
|
||||||
|
}
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue