Automattic\WooCommerce\Database\Migrations
MigrationHelper::migrate_country_states()
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.
Return
true|false
. True if there are more records that need to be migrated, false otherwise.
Usage
$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() MigrationHelper::migrate country states code WC 9.7.1
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; }