Merge branch 'pr/15384'

This commit is contained in:
Mike Jolley 2017-06-01 12:09:04 +01:00
commit d161ba0216
1 changed files with 14 additions and 0 deletions

View File

@ -850,3 +850,17 @@ function wc_cancel_unpaid_orders() {
wp_schedule_single_event( time() + ( absint( $held_duration ) * 60 ), 'woocommerce_cancel_unpaid_orders' );
}
add_action( 'woocommerce_cancel_unpaid_orders', 'wc_cancel_unpaid_orders' );
/**
* Sanitize order id removing unwanted characters.
*
* E.g Users can sometimes try to track an order id using # with no success.
* This function will fix this.
*
* @since 3.1.0
* @param int $order_id
*/
function wc_sanitize_order_id( $order_id ) {
return filter_var( $order_id, FILTER_SANITIZE_NUMBER_INT );
}
add_filter( 'woocommerce_shortcode_order_tracking_order_id', 'wc_sanitize_order_id' );