WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WC_Order_Data_Store_CPT::search_orders() public WC 1.0

Search order data for a term and return ids.

{} Это метод класса: WC_Order_Data_Store_CPT{}

Возвращает

Массив. of ids

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

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

Код WC_Order_Data_Store_CPT::search_orders() WC 5.3.0

<?php
public function search_orders( $term ) {
	global $wpdb;

	/**
	 * Searches on meta data can be slow - this lets you choose what fields to search.
	 * 3.0.0 added _billing_address and _shipping_address meta which contains all address data to make this faster.
	 * This however won't work on older orders unless updated, so search a few others (expand this using the filter if needed).
	 *
	 * @var array
	 */
	$search_fields = array_map(
		'wc_clean',
		apply_filters(
			'woocommerce_shop_order_search_fields',
			array(
				'_billing_address_index',
				'_shipping_address_index',
				'_billing_last_name',
				'_billing_email',
			)
		)
	);
	$order_ids     = array();

	if ( is_numeric( $term ) ) {
		$order_ids[] = absint( $term );
	}

	if ( ! empty( $search_fields ) ) {
		$order_ids = array_unique(
			array_merge(
				$order_ids,
				$wpdb->get_col(
					$wpdb->prepare(
						"SELECT DISTINCT p1.post_id FROM {$wpdb->postmeta} p1 WHERE p1.meta_value LIKE %s AND p1.meta_key IN ('" . implode( "','", array_map( 'esc_sql', $search_fields ) ) . "')", // @codingStandardsIgnoreLine
						'%' . $wpdb->esc_like( wc_clean( $term ) ) . '%'
					)
				),
				$wpdb->get_col(
					$wpdb->prepare(
						"SELECT order_id
						FROM {$wpdb->prefix}woocommerce_order_items as order_items
						WHERE order_item_name LIKE %s",
						'%' . $wpdb->esc_like( wc_clean( $term ) ) . '%'
					)
				)
			)
		);
	}

	return apply_filters( 'woocommerce_shop_order_search_results', $order_ids, $term, $search_fields );
}