MigrationHelper::migrate_country_states_for_tax_rates()private staticWC 1.0

Migrate state codes in the tax rates table.

Method of the class: MigrationHelper{}

No Hooks.


null. Nothing.


$result = MigrationHelper::migrate_country_states_for_tax_rates( $country_code, $old_to_new_states_mapping ): void;
$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_for_tax_rates() code WC 7.7.0

private static function migrate_country_states_for_tax_rates( string $country_code, array $old_to_new_states_mapping ): void {
	global $wpdb;

	foreach ( $old_to_new_states_mapping as $old_state_code => $new_state_code ) {
				"UPDATE {$wpdb->prefix}woocommerce_tax_rates SET tax_rate_state=%s WHERE tax_rate_country=%s AND tax_rate_state=%s",