Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_tax_rate

Updated
On this page

Filters the decimal tax rate of a menu item.

Returned by rpress_get_fooditem_tax_rate(). The rate is a decimal such as 0.05 for 5 percent. For the standard class it comes from rpress_get_tax_rate() and its filters, otherwise from the class rate divided by 100. The result is cast to float.

Parameters#

ParameterTypeDescription
$ratefloatDecimal tax rate.
$fooditem_idintMenu item ID.
$classstringTax class slug.
$countrystring|boolCountry, or false.
$statestring|boolState, or false.

Return value#

float. Decimal tax rate.

Example#

function my_fooditem_tax_rate( $rate, $fooditem_id, $class, $country, $state ) {
	if ( 'reduced' === $class && 'IE' === $country ) {
		return 0.09;
	}
	return $rate;
}
add_filter( 'rpress_fooditem_tax_rate', 'my_fooditem_tax_rate', 10, 5 );

Source#

Applied in:

  • includes/tax-functions.php (line 262), in rpress_get_fooditem_tax_rate()

See also#

Was this page helpful?