Skip to content
Docs
Get RestroPress

Filter

rpress_get_cart_addon_tax

Updated
On this page

Filters the tax calculated for an add-on in the cart.

Runs at the end of RPRESS_Cart::get_addon_tax(). The tax is zero for add-ons flagged as tax exclusive and is never negative before filtering.

Parameters#

ParameterTypeDescription
$valuefloatTax amount for the add-on.
$addon_idintAdd-on term ID.
$optionsarrayCart item data.
$subtotalfloatAdd-on subtotal the tax was calculated on.

Return value#

float. The tax amount.

Example#

function my_cart_addon_tax( $tax, $addon_id, $options, $subtotal ) {
	return round( $tax, 2 );
}
add_filter( 'rpress_get_cart_addon_tax', 'my_cart_addon_tax', 10, 4 );

Source#

Applied in:

  • includes/cart/class-rpress-cart.php (line 973), in RPRESS_Cart::get_addon_tax()

See also#

Was this page helpful?