WC_Site_Tracking::is_tracking_enabled() public WC 1.0
Check if tracking is enabled.
{} Это метод класса: WC_Site_Tracking{}
Хуки из метода
Возвращает
true/false.
Использование
$result = WC_Site_Tracking::is_tracking_enabled();
Код WC_Site_Tracking::is_tracking_enabled() WC Site Tracking::is tracking enabled WC 5.0.0
public static function is_tracking_enabled() {
/**
* Don't track users if a filter has been applied to turn it off.
* `woocommerce_apply_tracking` will be deprecated. Please use
* `woocommerce_apply_user_tracking` instead.
*/
if ( ! apply_filters( 'woocommerce_apply_user_tracking', true ) || ! apply_filters( 'woocommerce_apply_tracking', true ) ) {
return false;
}
// Check if tracking is actively being opted into.
$is_obw_opting_in = isset( $_POST['wc_tracker_checkbox'] ) && 'yes' === sanitize_text_field( $_POST['wc_tracker_checkbox'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput
/**
* Don't track users who haven't opted-in to tracking or aren't in
* the process of opting-in.
*/
if ( 'yes' !== get_option( 'woocommerce_allow_tracking' ) && ! $is_obw_opting_in ) {
return false;
}
if ( ! class_exists( 'WC_Tracks' ) ) {
return false;
}
return true;
}