Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableSearchQuery::generate_join()privateWC 1.0

Generates the necessary JOIN 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_join(): string;

OrdersTableSearchQuery::generate_join() code WC 7.1.0

private function generate_join(): string {
	$orders_table = $this->query->get_table_name( 'orders' );
	$meta_table   = $this->query->get_table_name( 'meta' );
	$items_table  = $this->query->get_table_name( 'items' );

	return "
		LEFT JOIN $meta_table AS search_query_meta ON search_query_meta.order_id = $orders_table.id
		LEFT JOIN $items_table AS search_query_items ON search_query_items.order_id = $orders_table.id
	";
}