Skip to content
Docs
Get RestroPress

Filter

rpress_get_cart_tax_rate

Updated
On this page

Filters the tax rate for the cart.

Runs at the end of rpress_get_cart_tax_rate(). The rate comes from rpress_get_tax_rate() for the given country and state and is cast to a float.

Parameters#

ParameterTypeDescription
$valuefloatTax rate.
$countrystringBilling country code.
$statestringBilling state.
$postal_codestringPostal code; unused by core.

Return value#

float. The tax rate.

Example#

function my_cart_tax_rate( $rate, $country, $state, $postal_code ) {
	return $rate;
}
add_filter( 'rpress_get_cart_tax_rate', 'my_cart_tax_rate', 10, 4 );

Notes#

Core ignores the postal code; it is passed so extensions can use it.

Source#

Applied in:

  • includes/cart/functions.php (line 412), in rpress_get_cart_tax_rate()

See also#

Was this page helpful?