Automattic\WooCommerce\Admin\API
Init::add_currency_symbol_to_order_response
Add the currency symbol (in addition to currency code) to each Order object in REST API responses. For use in formatAmount().
Method of the class: Init{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Init::add_currency_symbol_to_order_response( $response );
- $response(WP_REST_Response) (required)
- REST response object.
Init::add_currency_symbol_to_order_response() Init::add currency symbol to order response code WC 10.4.3
public static function add_currency_symbol_to_order_response( $response ) {
$response_data = $response->get_data();
$currency_code = $response_data['currency'];
$currency_symbol = get_woocommerce_currency_symbol( $currency_code );
$response_data['currency_symbol'] = html_entity_decode( $currency_symbol );
$response->set_data( $response_data );
return $response;
}