WC_Settings_Tracking::add_option_to_list()publicWC 1.0

Add a WooCommerce option name to our allowed options list and attach the update_option Rather than inspecting every updated option and pattern matching for "woocommerce", just build a dynamic list for WooCommerce options that might get updated.

See woocommerce_update_option

Method of the class: WC_Settings_Tracking{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Settings_Tracking = new WC_Settings_Tracking();
$WC_Settings_Tracking->add_option_to_list( $option );
$option(array) (required)
WooCommerce option (config) that might get updated.

WC_Settings_Tracking::add_option_to_list() code WC 8.7.0

public function add_option_to_list( $option ) {
	$this->allowed_options[] = $option['id'];

	if ( isset( $option['options'] ) ) {
		$this->dropdown_menu_options[] = $option['id'];
	}

	// Delay attaching this action since it could get fired a lot.
	if ( false === has_action( 'update_option', array( $this, 'track_setting_change' ) ) ) {
		add_action( 'update_option', array( $this, 'track_setting_change' ), 10, 3 );
	}
}