Hi there,
You could use something like this to display the total quantity in the admin Order screen like in your screenshot:
function get_total_number_of_items_in_order( $order_id ) {
$order = wc_get_order( $order_id );
$total_quantity = 0;
foreach ( $order->get_items() as $item_id => $item ) {
$quantity = $item->get_quantity();
$total_quantity += $quantity;
}
return $total_quantity;
}
function display_total_quantity_in_order_details( $order_id ) {
$total_quantity = get_total_number_of_items_in_order( $order_id );
?>
<tr>
<td class="label"><?php esc_html_e( 'Total Quantity:', 'woocommerce' ); ?></td>
<td width="1%"></td>
<td class="total">
<?php echo $total_quantity; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</td>
</tr>
<?php
}
add_action( 'woocommerce_admin_order_totals_after_discount', 'display_total_quantity_in_order_details', 10 );
`
As for the emails, you could override the email template file for any emails you want to add it to, then use the method above to get the total number of items and display it where you want in the email. We have a guide for overriding template files here:
https://docs.woocommerce.com/document/template-structure/