Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableSearchQuery::get_meta_fields_to_be_searched()
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).
Method of the class: OrdersTableSearchQuery{}
Hooks from the method
Return
String
.
Usage
// private - for code of main (parent) class only $result = $this->get_meta_fields_to_be_searched(): string;
OrdersTableSearchQuery::get_meta_fields_to_be_searched() OrdersTableSearchQuery::get meta fields to be searched code 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 ); }