WC_Settings_Tracking::send_settings_change_event()publicWC 1.0

Send a Tracks event for WooCommerce options that changed values.

Метод класса: WC_Settings_Tracking{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Settings_Tracking = new WC_Settings_Tracking();
$WC_Settings_Tracking->send_settings_change_event();

Код WC_Settings_Tracking::send_settings_change_event() WC 8.7.0

public function send_settings_change_event() {
	global $current_tab, $current_section;

	if ( empty( $this->updated_options ) && empty( $this->deleted_options ) && empty( $this->added_options ) ) {
		return;
	}

	$properties = array();

	if ( ! empty( $this->updated_options ) ) {
		$properties['settings'] = implode( ',', $this->updated_options );
	}

	if ( ! empty( $this->deleted_options ) ) {
		$properties['deleted'] = implode( ',', $this->deleted_options );
	}

	if ( ! empty( $this->added_options ) ) {
		$properties['added'] = implode( ',', $this->added_options );
	}

	foreach ( $this->toggled_options as $state => $options ) {
		if ( ! empty( $options ) ) {
			$properties[ $state ] = implode( ',', $options );
		}
	}

	if ( ! empty( $this->modified_options ) ) {
		foreach ( $this->modified_options as $option_name => $selected_option ) {
			$properties[ $option_name ] = $selected_option ?? '';
		}
	}

	$properties['tab']     = $current_tab ?? '';
	$properties['section'] = $current_section ?? '';

	WC_Tracks::record_event( 'settings_change', $properties );
}