Add currency_symbol to order response

This commit is contained in:
Mike Jolley 2019-06-06 14:38:13 +01:00
parent 6cbe095fc6
commit f4da7e1826
2 changed files with 12 additions and 0 deletions

View File

@ -237,6 +237,10 @@ class Orders extends AbstractObjectsController {
);
}
// Currency symbols.
$currency_symbol = get_woocommerce_currency_symbol( $data['currency'] );
$data['currency_symbol'] = html_entity_decode( $currency_symbol );
return array(
'id' => $object->get_id(),
'parent_id' => $data['parent_id'],
@ -246,6 +250,7 @@ class Orders extends AbstractObjectsController {
'version' => $data['version'],
'status' => $data['status'],
'currency' => $data['currency'],
'currency_symbol' => $data['currency_symbol'],
'date_created' => $data['date_created'],
'date_created_gmt' => $data['date_created_gmt'],
'date_modified' => $data['date_modified'],
@ -869,6 +874,12 @@ class Orders extends AbstractObjectsController {
'enum' => array_keys( get_woocommerce_currencies() ),
'context' => array( 'view', 'edit' ),
),
'currency_symbol' => array(
'description' => __( 'Currency symbol.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'date_created' => array(
'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time',

View File

@ -5,6 +5,7 @@
- All endpoints - Rewritten with namespaces as standalone classes.
- Coupons - Added `search` parameter.
- Orders - Added order number to schema.
- Orders - Added currency_symbol to schema.
- Product Reviews - Updated response links.
- Products - Added `low_in_stock` and `search` parameter.
- Product Variations - Added `search` parameter.