Fix toggle tracking
This commit is contained in:
parent
ca88734006
commit
7abd23438d
|
@ -215,7 +215,6 @@ abstract class WC_Settings_API {
|
|||
}
|
||||
}
|
||||
}
|
||||
$this->add_admin_options_tracking();
|
||||
|
||||
return update_option( $this->get_option_key(), apply_filters( 'woocommerce_settings_api_sanitized_fields_' . $this->id, $this->settings ), 'yes' );
|
||||
}
|
||||
|
|
|
@ -3086,16 +3086,20 @@ class WC_AJAX {
|
|||
continue;
|
||||
}
|
||||
$enabled = $gateway->get_option( 'enabled', 'no' );
|
||||
$gateway->add_admin_options_tracking();
|
||||
$option = array(
|
||||
'id' => $gateway->get_option_key()
|
||||
);
|
||||
|
||||
if ( ! wc_string_to_bool( $enabled ) ) {
|
||||
if ( $gateway->needs_setup() ) {
|
||||
wp_send_json_error( 'needs_setup' );
|
||||
wp_die();
|
||||
} else {
|
||||
do_action( 'woocommerce_update_option', $option );
|
||||
$gateway->update_option( 'enabled', 'yes' );
|
||||
}
|
||||
} else {
|
||||
do_action( 'woocommerce_update_option', $option );
|
||||
// Disable the gateway.
|
||||
$gateway->update_option( 'enabled', 'no' );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ class WC_Settings_Tracking {
|
|||
public function init() {
|
||||
add_action( 'woocommerce_settings_page_init', array( $this, 'track_settings_page_view' ) );
|
||||
add_action( 'woocommerce_update_option', array( $this, 'add_option_to_list' ) );
|
||||
add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'add_option_to_list' ) );
|
||||
add_action( 'woocommerce_update_options', array( $this, 'send_settings_change_event' ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue