Schema: Make display_key and *_value available for v3 and v2

This is just the schema and the actual functionality isn't implemented yet.
This commit is contained in:
Shiki 2020-08-12 15:25:18 -06:00 committed by vedanshujain
parent b9ae830da5
commit a3f46e5526
2 changed files with 10 additions and 12 deletions

View File

@ -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' ),
),
),
),
),

View File

@ -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;
}