MigrationHelper::migrate_country_states()public staticWC 1.0

Migrate state codes in all the required places in the database, needed after they change for a given country.

Method of the class: MigrationHelper{}

No Hooks.


true|false. True if there are more records that need to be migrated, false otherwise.


$result = MigrationHelper::migrate_country_states( $country_code, $old_to_new_states_mapping ): bool;
$country_code(string) (required)
The country that has the states for which the migration is needed.
$old_to_new_states_mapping(array) (required)
An associative array where keys are the old state codes and values are the new state codes.

MigrationHelper::migrate_country_states() code WC 7.7.0

public static function migrate_country_states( string $country_code, array $old_to_new_states_mapping ): bool {
	$more_remaining = self::migrate_country_states_for_orders( $country_code, $old_to_new_states_mapping );
	if ( ! $more_remaining ) {
		self::migrate_country_states_for_misc_data( $country_code, $old_to_new_states_mapping );
	return $more_remaining;