Fix `track_setting_change` method

This commit is contained in:
Fernando Marichal 2022-02-05 09:54:10 -03:00
parent 59b4c806f6
commit eb44888a79
1 changed files with 1 additions and 12 deletions

View File

@ -63,7 +63,6 @@ class WC_Settings_Tracking {
* @param mixed $new_value New value of option. * @param mixed $new_value New value of option.
*/ */
public function track_setting_change( $option_name, $old_value, $new_value ) { public function track_setting_change( $option_name, $old_value, $new_value ) {
global $current_tab;
// Make sure this is a WooCommerce option. // Make sure this is a WooCommerce option.
if ( ! in_array( $option_name, $this->allowed_options, true ) ) { if ( ! in_array( $option_name, $this->allowed_options, true ) ) {
return; return;
@ -80,19 +79,9 @@ class WC_Settings_Tracking {
return; return;
} }
// Verify if this is a Payments tab setting.
// This tab has a different way to save and track settings.
if ( 'checkout' === $current_tab ) {
// Format the updated option to send it later.
foreach ( array_diff( $new_value, $old_value ) as $key => $value ) {
$this->updated_options[] = $key . '=' . $value;
}
} else {
$this->updated_options[] = $option_name; $this->updated_options[] = $option_name;
} }
}
/** /**
* Send a Tracks event for WooCommerce options that changed values. * Send a Tracks event for WooCommerce options that changed values.
*/ */