WC_API_Taxes::get_taxes()publicWC 2.5.0

Get all taxes

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

Хуков нет.

Возвращает

Массив.

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

$WC_API_Taxes = new WC_API_Taxes();
$WC_API_Taxes->get_taxes( $fields, $filter, $class, $page );
$fields(строка)
-
По умолчанию: null
$filter(массив)
-
По умолчанию: array()
$class(строка)
-
По умолчанию: null
$page(int)
-
По умолчанию: 1

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

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

Код WC_API_Taxes::get_taxes() WC 8.7.0

public function get_taxes( $fields = null, $filter = array(), $class = null, $page = 1 ) {
	if ( ! empty( $class ) ) {
		$filter['tax_rate_class'] = $class;
	}

	$filter['page'] = $page;

	$query = $this->query_tax_rates( $filter );

	$taxes = array();

	foreach ( $query['results'] as $tax ) {
		$taxes[] = current( $this->get_tax( $tax->tax_rate_id, $fields ) );
	}

	// Set pagination headers
	$this->server->add_pagination_headers( $query['headers'] );

	return array( 'taxes' => $taxes );
}