WordPress at a glance
function is not described

WC_API_Taxes::delete_tax() public WC 2.5.0

Delete a tax

{} It's a method of the class: WC_API_Taxes{}

No Hooks.

Return

Array|WP_Error.

Usage

$WC_API_Taxes = new WC_API_Taxes();
$WC_API_Taxes->delete_tax( $id );
$id(int) (required)
The tax ID

Changelog

Since 2.5.0 Introduced.

Code of WC_API_Taxes::delete_tax() WC 5.0.0

<?php
public function delete_tax( $id ) {
	global $wpdb;

	try {
		// Check permissions
		if ( ! current_user_can( 'manage_woocommerce' ) ) {
			throw new WC_API_Exception( 'woocommerce_api_user_cannot_delete_tax', __( 'You do not have permission to delete tax rates', 'woocommerce' ), 401 );
		}

		$id = absint( $id );

		WC_Tax::_delete_tax_rate( $id );

		if ( 0 === $wpdb->rows_affected ) {
			throw new WC_API_Exception( 'woocommerce_api_cannot_delete_tax', __( 'Could not delete the tax rate', 'woocommerce' ), 401 );
		}

		return array( 'message' => sprintf( __( 'Deleted %s', 'woocommerce' ), 'tax' ) );
	} catch ( WC_API_Exception $e ) {
		return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
	}
}