Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableSearchQuery::get_meta_fields_to_be_searched()privateWC 1.0

Returns the order meta field keys to be searched.

These will be returned as a single string, where the meta keys have been escaped, quoted and are comma-separated (ie, "'abc', 'foo'" - ready for inclusion in a SQL IN() clause).

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

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_meta_fields_to_be_searched(): string;

Код OrdersTableSearchQuery::get_meta_fields_to_be_searched() WC 8.7.0

private function get_meta_fields_to_be_searched(): string {
	$meta_fields_to_search = array(
		'_billing_address_index',
		'_shipping_address_index',
	);

	/**
	 * Controls the order meta keys to be included in search queries.
	 *
	 * This hook is used when Custom Order Tables are in use: the corresponding hook when CPT-orders are in use
	 * is 'woocommerce_shop_order_search_fields'.
	 *
	 * @since 7.0.0
	 *
	 * @param array
	 */
	$meta_keys = apply_filters(
		'woocommerce_order_table_search_query_meta_keys',
		$meta_fields_to_search
	);

	$meta_keys = (array) array_map(
		function ( string $meta_key ): string {
			return "'" . esc_sql( wc_clean( $meta_key ) ) . "'";
		},
		$meta_keys
	);

	return implode( ',', $meta_keys );
}