Automattic\WooCommerce\Internal\Admin

OrderTaxLookupMigrator::order_has_stats_row │ private │ WC 1.0

Whether the order has a row in the order stats table, which is the table every analytics report reads orders through.

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

Хуков нет.

Возвращает

bool.

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

// private - только в коде основоного (родительского) класса
$result = $this->order_has_stats_row( $order_id ): bool;
$order_id(int) (обязательный)
Order id.

Код OrderTaxLookupMigrator::order_has_stats_row() WC 11.2.2

private function order_has_stats_row( int $order_id ): bool {
	global $wpdb;

	$table_name = OrderStatsDataStore::get_db_table_name();

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