WC_Orders_Tracking::track_order_search()
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.
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.
WC_Orders_Tracking::track_order_search() WC Orders Tracking::track order search code WC 7.7.0
public function track_order_search( $order_ids, $term, $search_fields ) { // 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; }