WC_API_Taxes::get_taxes() public WC 2.5.0
Get all taxes
{} It's a method of the class: WC_API_Taxes{}
No Hooks.
Return
Array.
Usage
$WC_API_Taxes = new WC_API_Taxes(); $WC_API_Taxes->get_taxes( $fields, $filter, $class, $page );
- $fields(string)
- -
- $filter(array)
- -
- $class(string)
- -
- $page(int)
- -
Changelog
Since 2.5.0 | Introduced. |
Code of WC_API_Taxes::get_taxes() WC API Taxes::get taxes WC 5.0.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 );
}