Automattic\WooCommerce\Internal\Admin\Schedulers

OrdersScheduler::has_order_stats_row │ private static │ WC 1.0

Check whether an order or refund already has a row in the order stats table.

Method of the class: OrdersScheduler{}

No Hooks.

Returns

bool.

Usage

$result = OrdersScheduler::has_order_stats_row( $order_id ): bool;
$order_id(int) (required)
Order or refund ID.

OrdersScheduler::has_order_stats_row() code WC 11.1.2

private static function has_order_stats_row( $order_id ): bool {
	global $wpdb;

	$table_name = OrdersStatsDataStore::get_db_table_name();

	// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
	return (bool) $wpdb->get_var( $wpdb->prepare( "SELECT order_id FROM {$table_name} WHERE order_id = %d LIMIT 1", $order_id ) );
}