WC_Install::migrate_options()public staticWC 1.0

Migrate option values to their new keys/names.

{} It's a method of the class: WC_Install{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Install::migrate_options();

Code of WC_Install::migrate_options() WC 6.7.0

public static function migrate_options() {

	$migrated_options = array(
		'woocommerce_onboarding_profile'           => 'wc_onboarding_profile',
		'woocommerce_admin_install_timestamp'      => 'wc_admin_install_timestamp',
		'woocommerce_onboarding_opt_in'            => 'wc_onboarding_opt_in',
		'woocommerce_admin_import_stats'           => 'wc_admin_import_stats',
		'woocommerce_admin_version'                => 'wc_admin_version',
		'woocommerce_admin_last_orders_milestone'  => 'wc_admin_last_orders_milestone',
		'woocommerce_admin-wc-helper-last-refresh' => 'wc-admin-wc-helper-last-refresh',
		'woocommerce_admin_report_export_status'   => 'wc_admin_report_export_status',
		'woocommerce_task_list_complete'           => 'woocommerce_task_list_complete',
		'woocommerce_task_list_hidden'             => 'woocommerce_task_list_hidden',
		'woocommerce_extended_task_list_complete'  => 'woocommerce_extended_task_list_complete',
		'woocommerce_extended_task_list_hidden'    => 'woocommerce_extended_task_list_hidden',
	);

	wc_maybe_define_constant( 'WC_ADMIN_MIGRATING_OPTIONS', true );

	foreach ( $migrated_options as $new_option => $old_option ) {
		$old_option_value = get_option( $old_option, false );

		// Continue if no option value was previously set.
		if ( false === $old_option_value ) {
			continue;
		}

		if ( '1' === $old_option_value ) {
			$old_option_value = 'yes';
		} elseif ( '0' === $old_option_value ) {
			$old_option_value = 'no';
		}

		update_option( $new_option, $old_option_value );
		if ( $new_option !== $old_option ) {
			delete_option( $old_option );
		}
	}
}