Filter
rpress_payment_paid_state
On this page
Filters the money state of an order.
Runs at the end of rpress_get_payment_paid_state(). The state is derived from the payment status: paid, unpaid, refunded, failed or abandoned. A completed order on an offline gateway counts as paid. The payment argument is an RPRESS_Payment, or null when the ID could not be resolved.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$state | string | One of paid, unpaid, refunded, failed or abandoned. |
$payment | RPRESS_Payment|null | Payment object, or null. |
Return value#
string. Money state.
Example#
function my_paid_state( $state, $payment ) {
if ( $payment && 'invoice' === $payment->gateway && 'unpaid' === $state ) {
return 'paid';
}
return $state;
}
add_filter( 'rpress_payment_paid_state', 'my_paid_state', 10, 2 );
Notes#
Return one of the five known states; the label function falls back to the unpaid wording for anything else.
Source#
Applied in:
includes/features/payments/payment-state.php(line 63), inrpress_get_payment_paid_state()
See also#
Was this page helpful?
