WC_Settings_Tracking::track_setting_change( string $option_name, mixed $old_value, mixed $new_value )
Add WooCommerce option to a list of updated options.
Description Description
Parameters Parameters
- $option_name
-
(Required) Option being updated.
- $old_value
-
(Required) Old value of option.
- $new_value
-
(Required) New value of option.
Source Source
File: includes/tracks/events/class-wc-settings-tracking.php
public function track_setting_change( $option_name, $old_value, $new_value ) { // Make sure this is a WooCommerce option. if ( ! in_array( $option_name, $this->whitelist, true ) ) { return; } // Check to make sure the new value is truly different. // `woocommerce_price_num_decimals` tends to trigger this // because form values aren't coerced (e.g. '2' vs. 2). if ( is_scalar( $old_value ) && is_scalar( $new_value ) && (string) $old_value === (string) $new_value ) { return; } $this->updated_options[] = $option_name; }