Automattic\WooCommerce\Internal\Shipping\FlatRate

WeightPlaceholder::get_for_package │ public │ WC 11.3.0

Get the total weight of the shippable items in a package, in the store's weight unit.

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

Хуков нет.

Возвращает

float.

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

$WeightPlaceholder = new WeightPlaceholder();
$WeightPlaceholder->get_for_package( $package ): float;
$package(массив) (обязательный)
Package of items from the cart.

Список изменений

С версии 11.3.0 Введена.

Код WeightPlaceholder::get_for_package() WC 11.3.0

public function get_for_package( array $package ): float {
	$items = $package['contents'] ?? array();

	return is_array( $items ) ? $this->get_for_items( $items ) : 0.0;
}