Filter
rpress_fooditem_tax_rate
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#
| Parameter | Type | Description |
|---|---|---|
$rate | float | Decimal tax rate. |
$fooditem_id | int | Menu item ID. |
$class | string | Tax class slug. |
$country | string|bool | Country, or false. |
$state | string|bool | State, 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), inrpress_get_fooditem_tax_rate()
See also#
Was this page helpful?
