Skip to content

Commit

Permalink
remove routes from API index
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Dec 14, 2024
1 parent 22621ae commit 8761384
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions includes/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ public function rest_index( WP_REST_Response $response ): WP_REST_Response {
$response->data['wcpos_version'] = VERSION;
$response->data['use_jwt_as_param'] = woocommerce_pos_get_settings( 'tools', 'use_jwt_as_param' );

/**
* Remove the routes from the response.
*
* Some wordpress sites have a huge number of routes, like 2MB of data. It shouldn;t matter, but it seems
* to cause issues with the desktop application sometimes. We don't use the routes at the moment, so we
* can remove them from the response.
*/
$data = $response->get_data();
unset( $data['routes'] );
$response->set_data( $data );

return $response;
}

Expand Down
3 changes: 3 additions & 0 deletions includes/API/Orders_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,9 @@ public function wcpos_shop_order_query( array $args, WP_REST_Request $request )
);
}

// @TODO - Add 'created_via' filter.
// 'created_via' is stored in the operational data table for HPOS and postmeta for legacy.

return $args;
}

Expand Down

0 comments on commit 8761384

Please # to comment.