Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableSearchQuery::generate_where()
Generates the necessary WHERE clauses for the order search to be performed.
Method of the class: OrdersTableSearchQuery{}
No Hooks.
Return
String
.
Usage
// private - for code of main (parent) class only $result = $this->generate_where(): string;
OrdersTableSearchQuery::generate_where() OrdersTableSearchQuery::generate where code WC 9.3.3
private function generate_where(): string { $where = array(); $possible_order_id = (string) absint( $this->search_term ); $order_table = $this->query->get_table_name( 'orders' ); // Support the passing of an order ID as the search term. if ( (string) $this->query->get( 's' ) === $possible_order_id ) { $where[] = "`$order_table`.id = $possible_order_id"; } foreach ( $this->search_filters as $search_filter ) { $search_where = $this->generate_where_for_search_filter( $search_filter ); if ( ! empty( $search_where ) ) { $where[] = $search_where; } } $where_statement = implode( ' OR ', $where ); return " ( $where_statement ) "; }