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.
Returns
String
.
Usage
// private - for code of main (parent) class only $result = $this->generate_where(): string;
OrdersTableSearchQuery::generate_where() OrdersTableSearchQuery::generate where code WC 9.9.5
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 = trim( $this->generate_where_for_search_filter( $search_filter ) ); if ( strlen( $search_where ) > 0 ) { $where[] = $search_where; } } $where_statement = implode( ' OR ', $where ); return ( strlen( $where_statement ) > 0 ) ? " ( $where_statement ) " : ''; }