Use the needs_payment function

Instead of checking against a list of valid order statuses, use the needs_payment function which already checks against those statuses
This commit is contained in:
Kevin Hagerty 2015-09-05 08:09:47 -04:00
parent e4b092fe10
commit 164b39ea42
1 changed files with 1 additions and 3 deletions

View File

@ -266,9 +266,7 @@ class WC_Form_Handler {
$order_id = absint( $wp->query_vars['order-pay'] ); $order_id = absint( $wp->query_vars['order-pay'] );
$order = wc_get_order( $order_id ); $order = wc_get_order( $order_id );
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order ); if ( $order->id == $order_id && $order->order_key == $order_key && $order->needs_payment() ) {
if ( $order->id == $order_id && $order->order_key == $order_key && $order->has_status( $valid_order_statuses ) ) {
// Set customer location to order location // Set customer location to order location
if ( $order->billing_country ) { if ( $order->billing_country ) {