Automattic\WooCommerce\DataBase\Migrations\CustomOrderTable

CLIRunner::get_verify_order_count()privateWC 1.0

Helper method to get count for orders needing verification.

Method of the class: CLIRunner{}

No Hooks.

Return

Int. Order count.

Usage

// private - for code of main (parent) class only
$result = $this->get_verify_order_count( $order_id_start, $log ) : int;
$order_id_start(int) (required)
Order ID to start from.
$log(true|false)
Whether to also log an error message.
Default: true

CLIRunner::get_verify_order_count() code WC 7.1.0

private function get_verify_order_count( int $order_id_start, $log = true ) : int {
	global $wpdb;

	$order_count = (int) $wpdb->get_var(
		$wpdb->prepare(
			"SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'shop_order' AND ID > %d",
			$order_id_start
		)
	);

	if ( $log ) {
		WP_CLI::log(
			sprintf(
				/* Translators: %1$d is the number of orders to be verified. */
				_n(
					'There is %1$d order to be verified.',
					'There are %1$d orders to be verified.',
					$order_count,
					'woocommerce'
				),
				$order_count
			)
		);
	}

	return $order_count;
}