gravityflowwoocommerce_valid_payment_statuses

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

ParameterTypeDefinition
$statusesArrayThe statuses you would like to capture the payment from.
$stepStepThe current step.

Examples

Add pending status

1
2
3
4
5
6
7
8
9
10
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?