WC_Email_Customer_Fulfillment_Created::get_fulfillment_item_countprivateWC 1.0

Get the total quantity of items in the fulfillment.

Method of the class: WC_Email_Customer_Fulfillment_Created{}

No Hooks.

Returns

Int.

Usage

// private - for code of main (parent) class only
$result = $this->get_fulfillment_item_count();

WC_Email_Customer_Fulfillment_Created::get_fulfillment_item_count() code WC 10.7.0

private function get_fulfillment_item_count() {
	if ( ! $this->fulfillment ) {
		return 1;
	}

	return array_reduce(
		$this->fulfillment->get_items(),
		function ( int $carry, array $item ) {
			return $carry + (int) $item['qty'];
		},
		0
	);
}