wc_taxonomy_metadata_migrate_data()WC 1.0

Migrate data from WC term meta to WP term meta.

When the database is updated to support term meta, migrate WC term meta data across. We do this when the new version is >= 34370, and the old version is < 34370 (34370 is when term meta table was added).

No Hooks.

Return

null. Nothing (null).

Usage

wc_taxonomy_metadata_migrate_data( $wp_db_version, $wp_current_db_version );
$wp_db_version(string) (required)
The new $wp_db_version.
$wp_current_db_version(string) (required)
The old (current) $wp_db_version.

wc_taxonomy_metadata_migrate_data() code WC 8.7.0

function wc_taxonomy_metadata_migrate_data( $wp_db_version, $wp_current_db_version ) {
	if ( $wp_db_version >= 34370 && $wp_current_db_version < 34370 ) {
		global $wpdb;
		if ( $wpdb->query( "INSERT INTO {$wpdb->termmeta} ( term_id, meta_key, meta_value ) SELECT woocommerce_term_id, meta_key, meta_value FROM {$wpdb->prefix}woocommerce_termmeta;" ) ) {
			$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}woocommerce_termmeta" );
		}
	}
}