WC_REST_Data_Continents_Controller::get_item()publicWC 3.5.0

Return the list of locations for a given continent.

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

Хуков нет.

Возвращает

WP_Error|WP_REST_Response.

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

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

Список изменений

С версии 3.5.0 Введена.

Код WC_REST_Data_Continents_Controller::get_item() WC 8.7.0

public function get_item( $request ) {
	$data = $this->get_continent( strtoupper( $request['location'] ), $request );
	if ( empty( $data ) ) {
		return new WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) );
	}
	return $this->prepare_item_for_response( $data, $request );
}