You can store the data in a session/cookie or use a database to store the temporary order before it's finalized.
For statistical purposes, how many didn't finish their order, what was in their cart when they cancelled etc you'd probably want to use a database.