Automattic\WooCommerce\Internal\Admin
OrderTaxLookupMigrator::order_has_stats_row
Whether the order has a row in the order stats table, which is the table every analytics report reads orders through.
Method of the class: OrderTaxLookupMigrator{}
No Hooks.
Returns
bool.
Usage
// private - for code of main (parent) class only $result = $this->order_has_stats_row( $order_id ): bool;
- $order_id(int) (required)
- Order id.
OrderTaxLookupMigrator::order_has_stats_row() OrderTaxLookupMigrator::order has stats row code WC 11.2.1
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
)
);
}