From 35ed2df4fb938d18d994eaa00f44fe108304fa7e Mon Sep 17 00:00:00 2001 From: Shiki Date: Wed, 12 Aug 2020 15:25:18 -0600 Subject: [PATCH] Schema: Make display_key and *_value available for v3 and v2 This is just the schema and the actual functionality isn't implemented yet. --- .../Version2/class-wc-rest-orders-v2-controller.php | 10 ++++++++++ .../Version3/class-wc-rest-orders-controller.php | 12 ------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php b/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php index 3dd928fc3eb..b9b10e6f6f0 100644 --- a/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php +++ b/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php @@ -1285,6 +1285,16 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), + 'display_key' => array( + 'description' => __( 'Meta key for UI display.', 'woocommerce-rest-api' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + ), + 'display_value' => array( + 'description' => __( 'Meta value for UI display.', 'woocommerce-rest-api' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + ), ), ), ), diff --git a/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php b/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php index 0d3ecc81215..3dd8f1aa6db 100644 --- a/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php +++ b/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php @@ -244,18 +244,6 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller { $schema['properties']['coupon_lines']['items']['properties']['discount']['readonly'] = true; - $meta_data_item_properties_ref = &$schema['properties']['line_items']['items']['properties']['meta_data']['items']['properties']; - $meta_data_item_properties_ref['display_key'] = array( - 'description' => __( 'Meta key for UI display.', 'woocommerce-rest-api' ), - 'type' => 'string', - 'context' => array( 'view', 'edit' ), - ); - $meta_data_item_properties_ref['display_value'] = array( - 'description' => __( 'Meta value for UI display.', 'woocommerce-rest-api' ), - 'type' => 'string', - 'context' => array( 'view', 'edit' ), - ); - return $schema; }