Items order on invoice

Items order on invoice

Hey all. 

I'm trying to sort items by category on our invoices, so that all the items belonging to a certaing type, are all grouped in the invoice in order to have a better understanding of it.

For example, if I run a candy shop, I want all my chocolate bars to be grouped, then all the gummies,  and not just an odd sorting based on the order that the client added the products in. 

I know Headers are a thing, but I'm looking for something automated. 

Any ideas? Thanks.