The gform_payment_statuses filter in Gravity Forms allows custom payment statuses to be defined.
Usage
add_filter('gform_payment_statuses', 'your_function_name', 10, 1);
Parameters
- $payment_statuses (array): An array of entry payment statuses with the entry value as the key (15 char max) to the text for display.
More information
See Gravity Forms Docs: gform_payment_statuses
Examples
Add a new payment status called “Tested”
This example demonstrates how to add a new payment status called “Tested” to the list of payment statuses.
add_filter('gform_payment_statuses', 'add_new_status', 10, 1); function add_new_status($payment_statuses) { $payment_statuses['Tested'] = 'Tested'; return $payment_statuses; }
Add multiple custom payment statuses
This example demonstrates how to add multiple custom payment statuses to the list of payment statuses.
add_filter('gform_payment_statuses', 'add_multiple_statuses', 10, 1); function add_multiple_statuses($payment_statuses) { $payment_statuses['PartiallyPaid'] = 'Partially Paid'; $payment_statuses['Overpaid'] = 'Overpaid'; return $payment_statuses; }
Modify an existing payment status
This example demonstrates how to modify an existing payment status by changing the display text.
add_filter('gform_payment_statuses', 'modify_existing_status', 10, 1); function modify_existing_status($payment_statuses) { $payment_statuses['Failed'] = 'Payment Failed'; return $payment_statuses; }
Remove an existing payment status
This example demonstrates how to remove an existing payment status from the list of payment statuses.
add_filter('gform_payment_statuses', 'remove_existing_status', 10, 1); function remove_existing_status($payment_statuses) { unset($payment_statuses['Pending']); return $payment_statuses; }
Change the order of payment statuses
This example demonstrates how to change the order of payment statuses in the list.
add_filter('gform_payment_statuses', 'change_status_order', 10, 1); function change_status_order($payment_statuses) { $new_statuses = [ 'Paid' => $payment_statuses['Paid'], 'Processing' => $payment_statuses['Processing'], 'Failed' => $payment_statuses['Failed'] ]; return $new_statuses; }