Skip to content

Commit 8761384

Browse files
committed
remove routes from API index
1 parent 22621ae commit 8761384

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

includes/API.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,17 @@ public function rest_index( WP_REST_Response $response ): WP_REST_Response {
240240
$response->data['wcpos_version'] = VERSION;
241241
$response->data['use_jwt_as_param'] = woocommerce_pos_get_settings( 'tools', 'use_jwt_as_param' );
242242

243+
/**
244+
* Remove the routes from the response.
245+
*
246+
* Some wordpress sites have a huge number of routes, like 2MB of data. It shouldn;t matter, but it seems
247+
* to cause issues with the desktop application sometimes. We don't use the routes at the moment, so we
248+
* can remove them from the response.
249+
*/
250+
$data = $response->get_data();
251+
unset( $data['routes'] );
252+
$response->set_data( $data );
253+
243254
return $response;
244255
}
245256

includes/API/Orders_Controller.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,9 @@ public function wcpos_shop_order_query( array $args, WP_REST_Request $request )
671671
);
672672
}
673673

674+
// @TODO - Add 'created_via' filter.
675+
// 'created_via' is stored in the operational data table for HPOS and postmeta for legacy.
676+
674677
return $args;
675678
}
676679

0 commit comments

Comments
 (0)