Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::search_orders()publicWC 1.0

Search order data for a term and return matching order IDs.

Метод класса: OrdersTableDataStore{}

Хуки из метода

Возвращает

int[]. Array of order IDs.

Использование

$OrdersTableDataStore = new OrdersTableDataStore();
$OrdersTableDataStore->search_orders( $term );
$term(строка) (обязательный)
Search term.

Код OrdersTableDataStore::search_orders() WC 7.3.0

public function search_orders( $term ) {
	$order_ids = wc_get_orders(
		array(
			's'      => $term,
			'return' => 'ids',
		)
	);

	/**
	 * Provides an opportunity to modify the list of order IDs obtained during an order search.
	 *
	 * This hook is used for Custom Order Table queries. For Custom Post Type order searches, the corresponding hook
	 * is `woocommerce_shop_order_search_results`.
	 *
	 * @since 7.0.0
	 *
	 * @param int[]  $order_ids Search results as an array of order IDs.
	 * @param string $term      The search term.
	 */
	return array_map( 'intval', (array) apply_filters( 'woocommerce_cot_shop_order_search_results', $order_ids, $term ) );
}