Automattic\WooCommerce\Internal\Admin\Orders

ListTable::set_search_args │ private │ WC 1.0

Implements order search.

Method of the class: ListTable{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->set_search_args(): void;

ListTable::set_search_args() code WC 11.1.2

private function set_search_args(): void {
	$search_term = trim( sanitize_text_field( $this->request['s'] ) );

	if ( ! empty( $search_term ) ) {
		$this->order_query_args['s'] = $search_term;
		$this->has_filter            = true;

		// 'search_filter' is inert without a search term, but setting it (the form always submits the dropdown)
		// would disqualify the request from the cached-count fast path in prepare_items() and force a COUNT.
		$filter = trim( sanitize_text_field( $this->request['search-filter'] ) );
		if ( ! empty( $filter ) ) {
			$this->order_query_args['search_filter'] = $filter;
		}
	}
}