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

Automattic\WooCommerce\Blocks\StoreApi\Utilities

CartController::get_shipping_packages() public WC 1.0

Get shipping packages from the cart with calculated shipping rates.

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

Хуков нет.

Возвращает

Массив.

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

$CartController = new CartController();
$CartController->get_shipping_packages( $calculate_rates );
$calculate_rates(true/false)
Should rates for the packages also be returned.

Код CartController::get_shipping_packages() WC 5.0.0

<?php
public function get_shipping_packages( $calculate_rates = true ) {
	$cart = $this->get_cart_instance();

	// See if we need to calculate anything.
	if ( ! $cart->needs_shipping() ) {
		return [];
	}

	$packages = $cart->get_shipping_packages();

	// Add package ID to array.
	foreach ( $packages as $key => $package ) {
		if ( ! isset( $packages[ $key ]['package_id'] ) ) {
			$packages[ $key ]['package_id'] = $key;
		}
	}

	return $calculate_rates ? wc()->shipping()->calculate_shipping( $packages ) : $packages;
}