I’m needing to have a customer’s total completed order count displayed on the new order emails going to the admin of the store. On “Get customer order count in new order email notification“ answer, but I’m not getting back the total completed orders. I’m also wanting it to display a message to alert the admin if it’s a customers first order.
I’ve linked the current script I’m using as an example, but it does not give accurate total past orders and I need it to gather counts by billing email address. I would like to only count completed orders also.