Description
The gravityflowwoocommerce_valid_payment_statuses filter allows you to customize what statuses are valid for the capture payment step beyond the default of ‘on-hold’.
See WooCommerce Capture Payment Step for more details.
Parameters
Parameter | Type | Definition |
---|---|---|
$statuses | Array | The statuses you would like to capture the payment from. |
$step | Step | The current step. |
Examples
Add pending status
add_filter( 'gravityflowwoocommerce_valid_payment_statuses', 'my_gravityflowwoocommerce_valid_payment_statuses', 10, 2 );
function my_gravityflowwoocommerce_valid_payment_statuses( $statuses, $step ) {
//Ensure you are only adjusting the desired form/step
if ( $step->get_id() !== 76 ) {
return $statuses;
} <br> if ( $step === 'woocommerce_capture_payment' ) {
$statuses[] = 'pending'; // Add the new status you'd like to capture the payment from.
}
return $statuses;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?