There are many instances where you may have virtual products in your store, or even every product may be virtual. There are snippets and plugins out there that cater to all orders, or certain orders… and this is just going to be another one of those.
This one will go through each line item in a new order, check that line item to see if it is a variation or a product, then check to see if that variation or product is virtual or not. If one line item in the order is not virtual, it exits. However, if every line item in the order is virtual, it sets the order to completed status.
Have fun, kiddos!