There're a lot of things to cover, so I'll separate each subject under its own heading.
Full integration with the User plugin is coming in v2 which I aim to be releasing before the year's out. Work on the user functionality in particular is currently about 70-80% complete.
Clear Basket on Checkout
This is one of those things that's been on the list since the beginning, but always got forgotten. You can already clear the basket by calling
Cart::destroy(); so there's no need for an additional method. However, that method isn't currently called from the plugin.
This one's quite easy, so I'll more than likely release it in an update soon.
I was just about to add this in, but it turns out the functionality is already there. The user's basket is automatically cleared after successful payment and saving the order. If you're not using the
/shop/order/payment/process route, you'll need to call the destroy method from your plugin.
Email Confirmation for Orders
Emails were planned to be added in v2 as part of the reinvented checkout process. While I'm not promising anything yet, I may consider bringing this feature forward - keep an eye on the changelog just in case!
Returning Created Order ID
The order ID is stored in the session, so if you wish to manipulate data you can already get the ID quite easily. In your code example you used it to find the order and remove each row, but that's overkill.
Cart::destroy() will empty the basket with no need for the order ID or calls to the database.
Next you append the order ID to the checkout URL it redirects to, but again, the order ID is already in the session so this isn't required.
That said, returning something when the order's created is trivial. It would likely be more useful to return the actual
$order object itself though... What do you think?
Could you give me some details on the sort of use cases you're thinking of with the extra parameters or modifying return values? I think I have a rough idea, but it'd be good to clarify and make sure we're both thinking the same thing.
Thanks for your feedback, hopefully you should see one or two things in an upcoming update. If you want to talk about the parameter/return use cases, come join us in IRC and ping me - I probably won't be far.