SeKra,
I know this was a while ago but I’m having trouble getting this to work. I’m trying to count the quantity for the order processing & complete email templates.
If I enter your code in the template, it creates a ‘0’ order. If i remove $order = new WC_Order( $order_id ); I get nothing.