wc_sanitize_order_id()WC 3.1.0

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.

No Hooks.

Return

null. Nothing (null).

Usage

wc_sanitize_order_id( $order_id );
$order_id(int) (required)
Order ID.

Changelog

Since 3.1.0 Introduced.

wc_sanitize_order_id() code WC 9.4.2

function wc_sanitize_order_id( $order_id ) {
	return (int) filter_var( $order_id, FILTER_SANITIZE_NUMBER_INT );
}