diff --git a/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php b/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php index cd603447639..691024ba947 100644 --- a/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php +++ b/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php @@ -217,6 +217,25 @@ 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. *