WC_Email_Customer_Fulfillment_Created::get_fulfillment_item_countprivateWC 1.0

Get the total quantity of items in the fulfillment.

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

Хуков нет.

Возвращает

int.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_fulfillment_item_count();

Код WC_Email_Customer_Fulfillment_Created::get_fulfillment_item_count() WC 10.8.1

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