woocommerce_hpos_generate_join_for_search_filter filter-hookWC 8.9.0

Filter to support adding a custom order search filter. Provide a JOIN clause for a new search filter. This should be used along with woocommerce_hpos_admin_search_filters declare a new custom filter, and woocommerce_hpos_generate_where_for_search_filter generate the WHERE clause.

Hardcoded JOINS (products) cannot be modified using this filter for consistency.

Usage

add_filter( 'woocommerce_hpos_generate_join_for_search_filter', 'wp_kama_woocommerce_hpos_generate_join_for_search_filter', 10, 4 );

/**
 * Function for `woocommerce_hpos_generate_join_for_search_filter` filter-hook.
 * 
 * @param string           $join          The JOIN clause.
 * @param string           $search_term   The search term.
 * @param string           $search_filter The search filter. Use this to bail early if this is not filter you are interested in.
 * @param OrdersTableQuery $query         The order query object.
 *
 * @return string
 */
function wp_kama_woocommerce_hpos_generate_join_for_search_filter( $join, $search_term, $search_filter, $query ){

	// filter...
	return $join;
}
$join(string)
The JOIN clause.
$search_term(string)
The search term.
$search_filter(string)
The search filter. Use this to bail early if this is not filter you are interested in.
$query(OrdersTableQuery)
The order query object.

Changelog

Since 8.9.0 Introduced.

Where the hook is called

OrdersTableSearchQuery::generate_join_for_search_filter()
woocommerce_hpos_generate_join_for_search_filter
woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php 131-137
return apply_filters(
	'woocommerce_hpos_generate_join_for_search_filter',
	'',
	$this->search_term,
	$search_filter,
	$this->query
);

Where the hook is used in WooCommerce

Usage not found.