Automattic\WooCommerce\Admin\API

Init::add_currency_symbol_to_order_response()public staticWC 1.0

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

Метод класса: Init{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = Init::add_currency_symbol_to_order_response( $response );
$response({WP_REST_Response}) (обязательный)
REST response object.

Код Init::add_currency_symbol_to_order_response() WC 8.7.0

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