Filter
rpress_customer_recount_should_process_payment
On this page
Filters whether a payment is counted when recalculating customer stats.
Runs for each payment while customer purchase value and count are recalculated, both for the bulk Recalculate Customer Stats tool and for the single customer recount. The default is true when the payment status is publish or revoked. Returning false excludes the payment from the customer's recalculated totals.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$should_process_payment | bool | Whether to process the payment. True for published and revoked payments by default. |
$payment | WP_Post | The payment post being evaluated. |
Return value#
bool. True to include the payment, false to skip it.
Example#
function my_recount_should_process_payment( $should_process_payment, $payment ) {
if ( 'refunded' === $payment->post_status ) {
return false;
}
return $should_process_payment;
}
add_filter( 'rpress_customer_recount_should_process_payment', 'my_recount_should_process_payment', 10, 2 );
Notes#
Fired from RPRESS_Tools_Recount_Customer_Stats and RPRESS_Tools_Recount_Single_Customer_Stats.
Source#
Applied in:
includes/admin/tools/class-rpress-tools-recount-customer-stats.php(line 84), inRPRESS_Tools_Recount_Customer_Stats::get_data()includes/admin/tools/class-rpress-tools-recount-single-customer-stats.php(line 65), inRPRESS_Tools_Recount_Single_Customer_Stats::get_data()
See also#
Was this page helpful?
