Filter
rpress_decrease_earnings_on_undo
On this page
Filters whether menu item earnings are decreased when a purchase is undone.
Runs for each line item in rpress_undo_purchase(). Only a strict true causes rpress_decrease_earnings() to be called for the item; The amount to be removed already accounts for negative fees on the item. Return false to leave the item untouched.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$decrease | bool | Default value; true means decrease. |
$payment | RPRESS_Payment | The payment object. |
$item_id | int | The menu item ID of the cart line being processed. |
Return value#
bool. Return true to decrease, false to skip.
Example#
add_filter( 'rpress_decrease_earnings_on_undo', 'my_keep_stats_on_undo_earnings', 10, 3 );
function my_keep_stats_on_undo_earnings( $decrease, $payment, $item_id ) {
if ( 'cash_on_delivery' === $payment->gateway ) {
return false;
}
return $decrease;
}
Notes#
Any value other than boolean true is treated as false.
Source#
Applied in:
includes/payments/functions.php(line 462), inrpress_undo_purchase()
See also#
Was this page helpful?
