woocommerce_calc_tax

The WooCommerce woocommerce calc tax hook.

Description

apply_filters( 'woocommerce_calc_tax', (unknown) $taxes, (unknown) $price, (unknown) $rates, (unknown) $price_includes_tax, (unknown) $suppress_rounding ); 

Parameters (5)

0. $taxes (unknown)
The taxes.
1. $price (unknown)
The price.
2. $rates (unknown)
The rates.
3. $price_includes_tax (unknown)
The price includes tax.
4. $suppress_rounding (unknown)
The suppress rounding.

Usage

To run the hook, copy the example below.
  1. $taxes = apply_filters( 'woocommerce_calc_tax', $taxes, $price, $rates, $price_includes_tax, $suppress_rounding ); 
  2.  
  3. if ( !empty( $taxes ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_calc_tax callback 
  2. function filter_woocommerce_calc_tax( $taxes, $price, $rates, $price_includes_tax, $suppress_rounding ) { 
  3. // make filter magic happen here... 
  4. return $taxes
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_calc_tax', 'filter_woocommerce_calc_tax', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_calc_tax', 'filter_woocommerce_calc_tax', 10, 5 ); 

Defined (1)

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

/includes/class-wc-tax.php  
  1. return apply_filters( 'woocommerce_calc_tax', $taxes, $price, $rates, $price_includes_tax, $suppress_rounding );