Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableDataStore::search_orders
Search order data for a term and return matching order IDs.
Method of the class: OrdersTableDataStore{}
Hooks from the method
Returns
Int[]. Array of order IDs.
Usage
$OrdersTableDataStore = new OrdersTableDataStore(); $OrdersTableDataStore->search_orders( $term );
- $term(string) (required)
- Search term.
OrdersTableDataStore::search_orders() OrdersTableDataStore::search orders code WC 10.7.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 ) );
}