Filter
rpress_addon_is_tax_exclusive
On this page
Filters whether an add-on item is excluded from tax.
Runs in rpress_addon_is_tax_exclusive(), used by the cart when computing tax for an add-on. Unlike the menu item version this uses strings: the default is 'no', and the cart treats any value other than 'yes' as taxable. Return 'yes' to exempt the add-on.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$is_exclusive | string | Default 'no'. |
$addon_id | int | Add-on item ID. |
Return value#
string. 'yes' to exempt the add-on from tax, otherwise 'no'.
Example#
function my_exempt_addon_from_tax( $is_exclusive, $addon_id ) {
if ( 'yes' === get_term_meta( $addon_id, 'my_tax_free', true ) ) {
return 'yes';
}
return $is_exclusive;
}
add_filter( 'rpress_addon_is_tax_exclusive', 'my_exempt_addon_from_tax', 10, 2 );
Notes#
Returning a boolean true does not exempt the add-on; the cart compares against the string 'yes'.
Source#
Applied in:
includes/tax-functions.php(line 193), inrpress_addon_is_tax_exclusive()
See also#
Was this page helpful?
