WC_Shipping_Flat_Rate::get_package_item_qty( array $package )

Get items in package.


Description Description


Parameters Parameters

$package

(Required) Package of items from cart.


Top ↑

Return Return

(int)


Top ↑

Source Source

File: includes/shipping/flat-rate/class-wc-shipping-flat-rate.php

	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;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.