WC_REST_Data_Currencies_Controller::get_currency()publicWC 1.0

Get currency information.

Method of the class: WC_REST_Data_Currencies_Controller{}

No Hooks.

Return

Array|Mixed. Response data, ready for insertion into collection data.

Usage

$WC_REST_Data_Currencies_Controller = new WC_REST_Data_Currencies_Controller();
$WC_REST_Data_Currencies_Controller->get_currency( $code, $request );
$code(string) (required)
Currency code.
$request(WP_REST_Request) (required)
Request data.

WC_REST_Data_Currencies_Controller::get_currency() code WC 8.7.0

public function get_currency( $code, $request ) {
	$currencies = get_woocommerce_currencies();
	$data       = array();

	if ( ! array_key_exists( $code, $currencies ) ) {
		return false;
	}

	$currency = array(
		'code'   => $code,
		'name'   => $currencies[ $code ],
		'symbol' => get_woocommerce_currency_symbol( $code ),
	);

	return $currency;
}