Merge pull request #5334 from ragulka/valid-order-statuses-improvements

Valid order statuses improvements
This commit is contained in:
Mike Jolley 2014-04-23 15:07:15 +01:00
commit c09f710775
2 changed files with 9 additions and 5 deletions

View File

@ -264,11 +264,13 @@ class WC_Form_Handler {
ob_start();
// Pay for existing order
$order_key = $_GET['key'];
$order_id = absint( $wp->query_vars['order-pay'] );
$order = new WC_Order( $order_id );
$order_key = $_GET['key'];
$order_id = absint( $wp->query_vars['order-pay'] );
$order = new WC_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 && in_array( $order->status, array( 'pending', 'failed' ) ) ) {
if ( $order->id == $order_id && $order->order_key == $order_key && in_array( $order->status, $valid_order_statuses ) ) {
// Set customer location to order location
if ( $order->billing_country ) {

View File

@ -1379,7 +1379,9 @@ class WC_Order {
unset( WC()->session->order_awaiting_payment );
}
if ( $this->id && ( 'on-hold' == $this->status || 'pending' == $this->status || 'failed' == $this->status ) ) {
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment_complete', array( 'on-hold', 'pending', 'failed' ), $this );
if ( $this->id && in_array( $this->status, $valid_order_statuses ) ) {
$order_needs_processing = true;