WC_Settings_Tracking::add_option_to_list_and_track_setting_changepublicWC 1.0

Adds the option to the allowed and updated options directly. Currently used for settings that don't use update_option.

Method of the class: WC_Settings_Tracking{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_Settings_Tracking = new WC_Settings_Tracking();
$WC_Settings_Tracking->add_option_to_list_and_track_setting_change( $option );
$option(array) (required)
WooCommerce option that should be updated.

WC_Settings_Tracking::add_option_to_list_and_track_setting_change() code WC 9.9.4

public function add_option_to_list_and_track_setting_change( $option ) {
	if ( ! in_array( $option['id'], $this->allowed_options, true ) ) {
		$this->allowed_options[] = $option['id'];
	}
	if ( isset( $option['action'] ) ) {
		if ( 'add' === $option['action'] ) {
			$this->added_options[] = $option['id'];
		} elseif ( 'delete' === $option['action'] ) {
			$this->deleted_options[] = $option['id'];
		} elseif ( ! in_array( $option['id'], $this->updated_options, true ) ) {
			$this->updated_options[] = $option['id'];
		}
	} elseif ( isset( $option['value'] ) ) {
		if ( 'select' === $option['type'] ) {
			$this->modified_options[ $option['id'] ] = $option['value'];

		} elseif ( 'checkbox' === $option['type'] ) {
			$option_state                             = 'yes' === $option['value'] ? 'enabled' : 'disabled';
			$this->toggled_options[ $option_state ][] = $option['id'];
		}
		$this->updated_options[] = $option['id'];
	}

}