WC_REST_Data_Currencies_Controller::get_items()publicWC 1.0

Return the list of currencies.

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

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

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

$WC_REST_Data_Currencies_Controller = new WC_REST_Data_Currencies_Controller();
$WC_REST_Data_Currencies_Controller->get_items( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код WC_REST_Data_Currencies_Controller::get_items() WC 9.3.3

public function get_items( $request ) {
	$currencies = get_woocommerce_currencies();
	$data       = array();
	foreach ( array_keys( $currencies ) as $code ) {
		$currency = $this->get_currency( $code, $request );
		$response = $this->prepare_item_for_response( $currency, $request );
		$data[]   = $this->prepare_response_for_collection( $response );
	}

	return rest_ensure_response( $data );
}