WC_Orders_Tracking::track_order_search( array $order_ids, string $term, array $search_fields )
Send a track event when on the Order Listing page, and search results are being displayed.
Description Description
Parameters Parameters
- $order_ids
-
(Required) Array of order_ids that are matches for the search.
- $term
-
(Required) The string that was used in the search.
- $search_fields
-
(Required) Fields that were used in the original search.
Source Source
File: includes/tracks/events/class-wc-orders-tracking.php
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;
}