1717use WP_REST_Response ;
1818use WP_REST_Server ;
1919
20+
2021/**
2122 *
2223 */
@@ -50,7 +51,7 @@ public function __construct() {
5051 add_filter ( 'determine_current_user ' , array ( $ this , 'determine_current_user ' ), 20 );
5152 add_filter ( 'rest_authentication_errors ' , array ( $ this , 'rest_authentication_errors ' ), 50 , 1 );
5253
53- // Adds uuid for the WordPress install
54+ // Adds info about the WordPress install
5455 add_filter ( 'rest_index ' , array ( $ this , 'rest_index ' ), 10 , 1 );
5556
5657 // These filters allow changes to the WC REST API response
@@ -219,9 +220,11 @@ public function get_auth_header() {
219220 }
220221
221222 /**
222- * Add uuid to the WP REST API index.
223+ * Adds info to the WP REST API index response.
224+ * - UUID
225+ * - Version Info
223226 *
224- * @param WP_REST_Response $response Response data
227+ * @param WP_REST_Response $response Response data.
225228 *
226229 * @return WP_REST_Response
227230 */
@@ -232,6 +235,9 @@ public function rest_index( WP_REST_Response $response ): WP_REST_Response {
232235 update_option ( 'woocommerce_pos_uuid ' , $ uuid );
233236 }
234237 $ response ->data ['uuid ' ] = $ uuid ;
238+ $ response ->data ['wp_version ' ] = get_bloginfo ( 'version ' );
239+ $ response ->data ['wc_version ' ] = WC ()->version ;
240+ $ response ->data ['wcpos_version ' ] = VERSION ;
235241
236242 return $ response ;
237243 }
0 commit comments