WC_REST_Data_Continents_Controller::get_items()publicWC 3.5.0

Return the list of states for all continents.

Method of the class: WC_REST_Data_Continents_Controller{}

No Hooks.

Return

WP_Error|WP_REST_Response.

Usage

$WC_REST_Data_Continents_Controller = new WC_REST_Data_Continents_Controller();
$WC_REST_Data_Continents_Controller->get_items( $request );
$request(WP_REST_Request) (required)
Request data.

Changelog

Since 3.5.0 Introduced.

WC_REST_Data_Continents_Controller::get_items() code WC 8.6.1

public function get_items( $request ) {
	$continents = WC()->countries->get_continents();
	$data       = array();

	foreach ( array_keys( $continents ) as $continent_code ) {
		$continent = $this->get_continent( $continent_code, $request );
		$response  = $this->prepare_item_for_response( $continent, $request );
		$data[]    = $this->prepare_response_for_collection( $response );
	}

	return rest_ensure_response( $data );
}