Automattic\WooCommerce\Internal\Admin
CustomerEffortScoreTracks::enable_survey_enqueing_if_tracking_is_enabled
Add actions that require woocommerce_allow_tracking.
Метод класса: CustomerEffortScoreTracks{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->enable_survey_enqueing_if_tracking_is_enabled();
Код CustomerEffortScoreTracks::enable_survey_enqueing_if_tracking_is_enabled() CustomerEffortScoreTracks::enable survey enqueing if tracking is enabled WC 10.5.0
private function enable_survey_enqueing_if_tracking_is_enabled() {
// Only hook up the action handlers if in wp-admin.
if ( ! is_admin() ) {
return;
}
// Do not hook up the action handlers if a mobile device is used.
if ( wp_is_mobile() ) {
return;
}
// Only enqueue a survey if tracking is allowed.
$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' );
if ( ! $allow_tracking ) {
return;
}
add_action( 'admin_init', array( $this, 'maybe_clear_ces_tracks_queue' ) );
add_action( 'woocommerce_update_options', array( $this, 'run_on_update_options' ), 10, 3 );
add_action( 'product_cat_add_form', array( $this, 'add_script_track_product_categories' ), 10, 3 );
add_action( 'product_tag_add_form', array( $this, 'add_script_track_product_tags' ), 10, 3 );
add_action( 'woocommerce_attribute_added', array( $this, 'run_on_add_product_attributes' ), 10, 3 );
add_action( 'load-edit.php', array( $this, 'run_on_load_edit_php' ), 10, 3 );
add_action( 'product_page_product_importer', array( $this, 'run_on_product_import' ), 10, 3 );
// Only hook up the transition_post_status action handler
// if on the edit page.
global $pagenow;
if ( 'post.php' === $pagenow ) {
add_action(
'transition_post_status',
array(
$this,
'run_on_transition_post_status',
),
10,
3
);
}
$this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce' );
}