Automattic\WooCommerce\Internal\Admin\Settings

Utils::order_map_change_min_order()public staticWC 1.0

Change the minimum order of an order map.

Метод класса: Utils{}

Хуков нет.

Возвращает

Массив. The updated order map.

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

$result = Utils::order_map_change_min_order( $order_map, $new_min_order ): array;
$order_map(массив) (обязательный)
The order map.
$new_min_order(int) (обязательный)
The new minimum order.

Код Utils::order_map_change_min_order() WC 9.6.1

public static function order_map_change_min_order( array $order_map, int $new_min_order ): array {
	// Sanity checks.
	if ( empty( $order_map ) ) {
		return array();
	}

	$updated_map = array();
	$bump        = $new_min_order - min( $order_map );
	foreach ( $order_map as $id => $order ) {
		$updated_map[ $id ] = $order + $bump;
	}

	asort( $updated_map );

	return $updated_map;
}