Automattic\WooCommerce\Internal\Admin\Settings
Utils::order_map_change_min_order
Change the minimum order of an order map.
Method of the class: Utils{}
No Hooks.
Returns
Array
. The updated order map.
Usage
$result = Utils::order_map_change_min_order( $order_map, $new_min_order ): array;
- $order_map(array) (required)
- The order map.
- $new_min_order(int) (required)
- The new minimum order.
Utils::order_map_change_min_order() Utils::order map change min order code WC 9.9.3
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; }