WordPress at Your Fingertips
function is not described

WC_Shipping_Legacy_Flat_Rate::get_package_item_qty() public WC 1.0

Get items in package.

{} It's a method of the class: WC_Shipping_Legacy_Flat_Rate{}

No Hooks.

Return

Int.

Usage

$WC_Shipping_Legacy_Flat_Rate = new WC_Shipping_Legacy_Flat_Rate();
$WC_Shipping_Legacy_Flat_Rate->get_package_item_qty( $package );
$package(array) (required)
Package information.

Code of WC_Shipping_Legacy_Flat_Rate::get_package_item_qty() WC 5.9.0

public function get_package_item_qty( $package ) {
	$total_quantity = 0;
	foreach ( $package['contents'] as $item_id => $values ) {
		if ( $values['quantity'] > 0 && $values['data']->needs_shipping() ) {
			$total_quantity += $values['quantity'];
		}
	}
	return $total_quantity;
}