WordPress at Your Fingertips
function is not described


Init::add_currency_symbol_to_order_response() public WC 1.0

Add the currency symbol (in addition to currency code) to each Order object in REST API responses. For use in formatAmount().

{} It's a method of the class: Init{}

No Hooks.


null. Nothing.


$result = Init::add_currency_symbol_to_order_response( $response );
$response({WP_REST_Response}) (required)
REST response object.

Code of Init::add_currency_symbol_to_order_response() WC 6.1.1

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;