WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Shipping::calculate_shipping() public WC 1.0

Calculate shipping for (multiple) packages of cart items.

Это метод класса: WC_Shipping{}

Хуки из метода
Возвращает

Массив. Array of calculated packages.

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

$WC_Shipping = new WC_Shipping();
$WC_Shipping->calculate_shipping( $packages );
$packages(массив)
multi-dimensional array of cart items to calc shipping for.
По умолчанию: array()

Код WC_Shipping::calculate_shipping() WC 4.5.2

woocommerce/includes/class-wc-shipping.php
<?php
public function calculate_shipping( $packages = array() ) {
	$this->packages = array();

	if ( ! $this->enabled || empty( $packages ) ) {
		return array();
	}

	// Calculate costs for passed packages.
	foreach ( $packages as $package_key => $package ) {
		$this->packages[ $package_key ] = $this->calculate_shipping_for_package( $package, $package_key );
	}

	/**
	 * Allow packages to be reorganized after calculating the shipping.
	 *
	 * This filter can be used to apply some extra manipulation after the shipping costs are calculated for the packages
	 * but before WooCommerce does anything with them. A good example of usage is to merge the shipping methods for multiple
	 * packages for marketplaces.
	 *
	 * @since 2.6.0
	 *
	 * @param array $packages The array of packages after shipping costs are calculated.
	 */
	$this->packages = array_filter( (array) apply_filters( 'woocommerce_shipping_packages', $this->packages ) );

	return $this->packages;
}