Automattic\WooCommerce\Utilities

OrderUtil::get_post_or_order_idpublic staticWC 1.0

Helper function to id from an post or order object.

Метод класса: OrderUtil{}

Хуков нет.

Возвращает

int. Order or post ID.

Использование

$result = OrderUtil::get_post_or_order_id( $post_or_order_object ) : int;
$post_or_order_object(WP_Post/WC_Order) (обязательный)
WP_Post/WC_Order object to get ID for.

Код OrderUtil::get_post_or_order_id() WC 9.9.3

public static function get_post_or_order_id( $post_or_order_object ) : int {
	return wc_get_container()->get( COTMigrationUtil::class )->get_post_or_order_id( $post_or_order_object );
}