Revert order and product controllers to use WP Post queries directly.

This commit revert some of the changes added in #27735 because wc_get_products and wc_get_orders is not fully compitable with API controller queries. Since we are close to release 4.9, its better to revert and fix them properly then rush a fix. This undones some the performance improvements we acheived in 27735, in favor of more stability, hopefully we will be able to restore this soon.
This commit is contained in:
vedanshujain 2021-01-07 14:20:23 +05:30
parent 007f3ec8aa
commit f8bcf6271d
2 changed files with 0 additions and 38 deletions

View File

@ -25,25 +25,6 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller {
*/
protected $namespace = 'wc/v3';
/**
* Get Orders.
*
* @param array $query_args Query args.
*
* @return array Products.
*/
protected function get_objects( $query_args ) {
$query_args['paginate'] = true;
$results = wc_get_orders( $query_args );
return array(
'objects' => $results->orders,
'total' => $results->total,
'pages' => $results->max_num_pages,
);
}
/**
* Calculate coupons.
*

View File

@ -220,25 +220,6 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller {
return $args;
}
/**
* Get products.
*
* @param array $query_args Query args.
*
* @return array Products.
*/
protected function get_objects( $query_args ) {
$query_args['paginate'] = true;
$query_args['return'] = 'objects';
$results = wc_get_products( $query_args );
return array(
'objects' => $results->products,
'total' => $results->total,
'pages' => $results->max_num_pages,
);
}
/**
* Set product images.
*