wc_update_340_state()
Update next state in the queue.
Description Description
Return Return
(bool) True to run again, false if completed.
Source Source
File: includes/wc-update-functions.php
function wc_update_340_state() { global $wpdb; $country_states = array_filter( (array) get_option( 'woocommerce_update_340_states', array() ) ); if ( empty( $country_states ) ) { return false; } foreach ( $country_states as $country => $states ) { foreach ( $states as $old => $new ) { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = %s WHERE meta_key IN ( '_billing_state', '_shipping_state' ) AND meta_value = %s", $new, $old ) ); $wpdb->update( "{$wpdb->prefix}woocommerce_shipping_zone_locations", array( 'location_code' => $country . ':' . $new, ), array( 'location_code' => $country . ':' . $old, ) ); $wpdb->update( "{$wpdb->prefix}woocommerce_tax_rates", array( 'tax_rate_state' => strtoupper( $new ), ), array( 'tax_rate_state' => strtoupper( $old ), ) ); unset( $country_states[ $country ][ $old ] ); if ( empty( $country_states[ $country ] ) ) { unset( $country_states[ $country ] ); } break 2; } } if ( ! empty( $country_states ) ) { return update_option( 'woocommerce_update_340_states', $country_states ); } delete_option( 'woocommerce_update_340_states' ); return false; }