Automattic\WooCommerce\Internal\Admin

CustomerEffortScoreTracks::run_on_load_edit_php()publicWC 1.0

Determine on initiating CES survey on searching for product or orders.

Method of the class: CustomerEffortScoreTracks{}

No Hooks.

Return

null. Nothing (null).

Usage

$CustomerEffortScoreTracks = new CustomerEffortScoreTracks();
$CustomerEffortScoreTracks->run_on_load_edit_php();

CustomerEffortScoreTracks::run_on_load_edit_php() code WC 9.3.3

public function run_on_load_edit_php() {
	$allowed_types = array( 'product', 'shop_order' );
	$post_type     = get_current_screen()->post_type;

	// We're only interested for certain post types.
	if ( ! in_array( $post_type, $allowed_types, true ) ) {
		return;
	}

	// Determine whether request is search by "s" GET parameter.
	if ( empty( $_GET['s'] ) ) { // phpcs:disable WordPress.Security.NonceVerification.Recommended
		return;
	}

	$page_now = 'edit-' . $post_type;
	$this->enqueue_ces_survey_for_search( $post_type, $page_now, 'edit-php' );
}