woocommerce_order_item_needs_processing. Closes #1592.

This commit is contained in:
Mike Jolley 2012-10-17 12:34:05 +01:00
parent c1c5cd6890
commit 36824b0849
1 changed files with 8 additions and 7 deletions

View File

@ -1238,27 +1238,28 @@ class WC_Order {
if ( $this->status == 'on-hold' || $this->status == 'pending' || $this->status == 'failed' ) { if ( $this->status == 'on-hold' || $this->status == 'pending' || $this->status == 'failed' ) {
$downloadable_order = false; $order_needs_processing = true;
if ( sizeof( $this->get_items() ) > 0 ) { if ( sizeof( $this->get_items() ) > 0 ) {
foreach( $this->get_items() as $item ) { foreach( $this->get_items() as $item ) {
if ( $item['id'] > 0 ) { if ( $item['id'] > 0 ) {
$_product = $this->get_product_from_item( $item ); $_product = $this->get_product_from_item( $item );
if ( $_product->is_downloadable() && $_product->is_virtual() ) { if ( ( $_product->is_downloadable() && $_product->is_virtual() ) || ! apply_filters( 'woocommerce_order_item_needs_processing', true, $_product, $this->id ) ) {
$downloadable_order = true; $order_needs_processing = false;
continue; continue;
} }
} }
$downloadable_order = false; $order_needs_processing = true;
break; break;
} }
} }
$new_order_status = ( $downloadable_order ) ? 'completed' : 'processing'; $new_order_status = $order_needs_processing ? 'processing' : 'completed';
$new_order_status = apply_filters( 'woocommerce_payment_complete_order_status', $new_order_status, $this->id ); $new_order_status = apply_filters( 'woocommerce_payment_complete_order_status', $new_order_status, $this->id );