Automattic\WooCommerce\Internal\DataStores\Orders

CustomOrdersTableController::process_options_updated()privateWC 1.0

Handler for the all settings updated hook.

Method of the class: CustomOrdersTableController{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->process_options_updated();

CustomOrdersTableController::process_options_updated() code WC 7.1.0

private function process_options_updated() {
	$data_sync_is_enabled = $this->data_synchronizer->data_sync_is_enabled();

	// Disabling the sync implies disabling the automatic authoritative table switch too.
	if ( ! $data_sync_is_enabled && $this->auto_flip_authoritative_table_enabled() ) {
		update_option( self::AUTO_FLIP_AUTHORITATIVE_TABLE_ROLES_OPTION, 'no' );
	}

	// Enabling/disabling the sync implies starting/stopping it too, if needed.
	// We do this check here, and not in process_pre_update_option, so that if for some reason
	// the setting is enabled but no sync is in process, sync will start by just saving the
	// settings even without modifying them (and the opposite: sync will be stopped if for
	// some reason it was ongoing while it was disabled).
	if ( $data_sync_is_enabled ) {
		$this->batch_processing_controller->enqueue_processor( DataSynchronizer::class );
	} else {
		$this->batch_processing_controller->remove_processor( DataSynchronizer::class );
	}
}