woocommerce_migrate_country_states_for_orders_batch_size хук-фильтрWC 7.2.0

Filters the value of N, where the maximum count of database records that will be updated in one single run of migrate_country_states_for_orders is N2count($old_to_new_states_mapping) if the woocommerce_orders table exists, or N*count($old_to_new_states_mapping) otherwise.

Использование

add_filter( 'woocommerce_migrate_country_states_for_orders_batch_size', 'wp_kama_woocommerce_migrate_country_states_for_orders_batch_size_filter', 10, 3 );

/**
 * Function for `woocommerce_migrate_country_states_for_orders_batch_size` filter-hook.
 * 
 * @param int    $batch_size                Default value for the count of records to update.
 * @param string $country_code              Country code for the update.
 * @param array  $old_to_new_states_mapping Associative array of old to new state codes.
 *
 * @return int
 */
function wp_kama_woocommerce_migrate_country_states_for_orders_batch_size_filter( $batch_size, $country_code, $old_to_new_states_mapping ){

	// filter...
	return $batch_size;
}
$batch_size(int)
Default value for the count of records to update.
$country_code(строка)
Country code for the update.
$old_to_new_states_mapping(массив)
Associative array of old to new state codes.

Список изменений

С версии 7.2.0 Введена.

Где вызывается хук

MigrationHelper::migrate_country_states_for_orders()
woocommerce_migrate_country_states_for_orders_batch_size
woocommerce/src/Database/Migrations/MigrationHelper.php 180
$limit      = apply_filters( 'woocommerce_migrate_country_states_for_orders_batch_size', 100, $country_code, $old_to_new_states_mapping );

Где используется хук в WooCommerce

Использование не найдено.