wc_get_tax_class_by_tax_id

Get tax class by tax id.

Description

(string) wc_get_tax_class_by_tax_id( (int) $tax_id ); 

Returns (string)

Parameters (1)

0. $tax_id (int)
The tax id.

Usage

  1. if ( !function_exists( 'wc_get_tax_class_by_tax_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-order-functions.php'; 
  3.  
  4. // The tax id. 
  5. $tax_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_get_tax_class_by_tax_id($tax_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-order-functions.php  
  1. function wc_get_tax_class_by_tax_id( $tax_id ) { 
  2. global $wpdb; 
  3. return $wpdb->get_var( $wpdb->prepare( "SELECT tax_rate_class FROM {$wpdb->prefix}woocommerce_tax_rates WHERE tax_rate_id = %d", $tax_id ) );