WooCommerce::handle_tracking_setting_change
Schedule the action send tracking events if tracking is enabled, or unregister it if tracking is disabled. This will be called when the woocommerce_allow_tracking option is updated.
Method of the class: WooCommerce{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WooCommerce = new WooCommerce(); $WooCommerce->handle_tracking_setting_change( $old_value, $value );
- $old_value(string) (required)
- The old value of the
woocommerce_allow_trackingoption. - $value(string) (required)
- The new value of the
woocommerce_allow_trackingoption.
WooCommerce::handle_tracking_setting_change() WooCommerce::handle tracking setting change code WC 10.7.0
public function handle_tracking_setting_change( $old_value, $value ) {
if ( $old_value === $value ) {
return;
}
if ( false === wc_string_to_bool( $value ) ) {
as_unschedule_all_actions( 'woocommerce_tracker_send_event_wrapper', array(), 'woocommerce' );
} else {
$this->schedule_tracking_action();
}
}