Merge pull request #2617 from maxrice/cancel-unpaid-orders-filter

Add filter to control automatic cancel of unpaid order
This commit is contained in:
Mike Jolley 2013-03-07 06:23:44 -08:00
commit fceb73c401
1 changed files with 3 additions and 1 deletions

View File

@ -2430,7 +2430,9 @@ function woocommerce_cancel_unpaid_orders() {
if ( $unpaid_orders ) {
foreach ( $unpaid_orders as $unpaid_order ) {
$order = new WC_Order( $unpaid_order );
$order->update_status( 'cancelled', __( 'Unpaid order cancelled - time limit reached.', 'woocommerce' ) );
if ( apply_filters( 'woocommerce_cancel_unpaid_order', true, $order ) )
$order->update_status( 'cancelled', __( 'Unpaid order cancelled - time limit reached.', 'woocommerce' ) );
}
}