WordPress at Your Fingertips
function is not described

WC_Order_Factory::get_order_id() public WC 3.0.0

Get the order ID depending on what was passed.

{} It's a method of the class: WC_Order_Factory{}

No Hooks.

Return

Int|true|false. false on failure

Usage

$result = WC_Order_Factory::get_order_id( $order );
$order(mixed) (required)
Order data to convert to an ID.

Changelog

Since 3.0.0 Introduced.

Code of WC_Order_Factory::get_order_id() WC 5.6.0

public static function get_order_id( $order ) {
	global $post;

	if ( false === $order && is_a( $post, 'WP_Post' ) && 'shop_order' === get_post_type( $post ) ) {
		return absint( $post->ID );
	} elseif ( is_numeric( $order ) ) {
		return $order;
	} elseif ( $order instanceof WC_Abstract_Order ) {
		return $order->get_id();
	} elseif ( ! empty( $order->ID ) ) {
		return $order->ID;
	} else {
		return false;
	}
}