Title: Total item (quantity) count
Last modified: August 30, 2016

---

# Total item (quantity) count

 *  [lucas7700](https://wordpress.org/support/users/lucas7700/)
 * (@lucas7700)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/total-item-quantity-count/)
 * I would like to add the total item count to the Quantity Subtotal line. How can
   I go about doing this? Thanks!
 * [https://wordpress.org/plugins/woocommerce-delivery-notes/](https://wordpress.org/plugins/woocommerce-delivery-notes/)

Viewing 1 replies (of 1 total)

 *  [otto.radics](https://wordpress.org/support/users/ottoradics/)
 * (@ottoradics)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/total-item-quantity-count/#post-6594685)
 * Hey Lucas!
 * I would do it this way:
 * Find the foreach loop, where the items are listed. In woocommerce-delivery-notes/
   templates/print-order/print-content.php it is located at the line 79:
    `<?php
   foreach( $order->get_items() as $item ) : ?>`
 * Now I would declare a variable, to count in every iteration the count of items:
 * `<?php $item_count_per_line = $item['qty'];?>`
 * This variable will change in every iteration, until the last items count. In 
   every loop iteration, I would add this variable to another variable, at the end
   of the foreach loop, at line 123, before <?php endforeach; ?>, like this:
 *     ```
       <?php $total_item_amount = $total_item_amount + $item_count_per_line;?>
       <?php endforeach; ?>
       ```
   
 * When the foreach loop finishes, you will have the total count of items, in the
   $total_item_amount variable. You can print it using `<?php echo $total_item_amount;?
   >`

Viewing 1 replies (of 1 total)

The topic ‘Total item (quantity) count’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-delivery-notes/assets/icon-256x256.jpg?rev=2829362)
 * [Print Invoice & Delivery Notes for WooCommerce](https://wordpress.org/plugins/woocommerce-delivery-notes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-delivery-notes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-delivery-notes/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-delivery-notes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-delivery-notes/reviews/)

## Tags

 * [item count](https://wordpress.org/support/topic-tag/item-count/)
 * [quantity](https://wordpress.org/support/topic-tag/quantity/)

 * 1 reply
 * 2 participants
 * Last reply from: [otto.radics](https://wordpress.org/support/users/ottoradics/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/total-item-quantity-count/#post-6594685)
 * Status: not resolved