Skip to content
Docs
Get RestroPress

Filter

rpress_should_process_refund

Updated
On this page

Filters whether RPRESS_Payment::process_refund should adjust stats for a refunded payment.

The default is true only when the payment was in the publish or revoked status and is now refunded. Return false to skip the refund processing, including the actions and the stats changes that follow. Custom payment types can use it to apply their own logic.

Parameters#

ParameterTypeDescription
$process_refundboolWhether the refund should be processed.
$paymentRPRESS_PaymentThe payment being refunded.

Return value#

bool. Whether to process the refund.

Example#

function my_should_process_refund( $process_refund, $payment ) {
	if ( $payment->get_meta( '_my_skip_refund_stats', true ) ) {
		return false;
	}
	return $process_refund;
}
add_filter( 'rpress_should_process_refund', 'my_should_process_refund', 10, 2 );

Source#

Applied in:

  • includes/payments/class-rpress-payment.php (line 1650), in RPRESS_Payment::process_refund()

See also#

Was this page helpful?