Parse order status properly
Make order status lowercase
Exclude cancelled orders from total
Calculate cancelled total
Break the loop when a match has been found
Unconditionally sanitize result and provide fallbacks