WC_Orders_Tracking::track_order_search()publicWC 1.0

Deprecated from version 8.6.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Send a track event when on the Order Listing page, and search results are being displayed.

Method of the class: WC_Orders_Tracking{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Orders_Tracking = new WC_Orders_Tracking();
$WC_Orders_Tracking->track_order_search( $order_ids, $term, $search_fields );
$order_ids(array) (required)
Array of order_ids that are matches for the search.
$term(string) (required)
The string that was used in the search.
$search_fields(array) (required)
Fields that were used in the original search.

Changelog

Deprecated since 8.6.0

WC_Orders_Tracking::track_order_search() code WC 8.6.1

public function track_order_search( $order_ids, $term, $search_fields ) {
	wc_deprecated_function( __METHOD__, '8.6.0', 'WC_Orders_Tracking::track_search_in_orders_list' );

	// Since `woocommerce_shop_order_search_results` can run in the front-end context, exit if get_current_screen isn't defined.
	if ( ! function_exists( 'get_current_screen' ) ) {
		return $order_ids;
	}

	$screen = get_current_screen();

	// We only want to record this track when the filter is executed on the order listing page.
	if ( 'edit-shop_order' === $screen->id ) {
		// we are on the order listing page, and query results are being shown.
		WC_Tracks::record_event( 'orders_view_search' );
	}

	return $order_ids;
}