WC_API_Taxes::get_taxes_count()
Get the total number of taxes
Method of the class: WC_API_Taxes{}
No Hooks.
Return
Array|WP_Error
.
Usage
$WC_API_Taxes = new WC_API_Taxes(); $WC_API_Taxes->get_taxes_count( $class, $filter );
- $class(string)
- -
Default: null - $filter(array)
- -
Default: array()
Changelog
Since 2.5.0 | Introduced. |
WC_API_Taxes::get_taxes_count() WC API Taxes::get taxes count code WC 7.7.0
public function get_taxes_count( $class = null, $filter = array() ) { try { if ( ! current_user_can( 'manage_woocommerce' ) ) { throw new WC_API_Exception( 'woocommerce_api_user_cannot_read_taxes_count', __( 'You do not have permission to read the taxes count', 'woocommerce' ), 401 ); } if ( ! empty( $class ) ) { $filter['tax_rate_class'] = $class; } $query = $this->query_tax_rates( $filter, true ); return array( 'count' => (int) $query['headers']->total ); } catch ( WC_API_Exception $e ) { return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) ); } }