Filter
rpress_tax_breakdown
On this page
Filters the per-class tax breakdown of cart or order lines.
Returned by rpress_get_tax_breakdown() after lines are grouped by tax class and rounded so the rows add up to the tax charged. The array is keyed by class slug, and each entry has name, rate (percentage), code and tax (amount). It is used for tax rows on the cart, receipts and order details.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$breakdown | array | Slug => array( name, rate, code, tax ). |
$lines | array | Cart or order lines the breakdown was built from. |
Return value#
array. The breakdown, with the same structure.
Example#
function my_tax_breakdown( $breakdown, $lines ) {
foreach ( $breakdown as $slug => $row ) {
if ( '' === $row['code'] ) {
$breakdown[ $slug ]['code'] = strtoupper( $slug );
}
}
return $breakdown;
}
add_filter( 'rpress_tax_breakdown', 'my_tax_breakdown', 10, 2 );
Notes#
Changing tax amounts here only changes what is displayed or stored from the breakdown, not the tax charged on the cart.
Source#
Applied in:
includes/tax-functions.php(line 326), inrpress_get_tax_breakdown()
See also#
Was this page helpful?
